fetch('http://10.58.2.215:8000/user/login', {
method: 'POST',
body: JSON.stringify({
email: this.state.id,
password: this.state.pw,
account: '',
}),
})
.then((res) => res.json())
.then((data) => {
console.log(data);
this.props.history.push('/mainPark');
});
fetch('http://10.58.2.215:8000/user/login', {
method: 'POST',
body: JSON.stringify({
email: this.state.id,
password: this.state.pw,
account: '',
}),
})
.then((res) => res.json())
.then((data) => {
console.log(data);
if (data.AUTHORIZATION) {
localStorage.setItem('test-token', data.AUTHORIZATION);
}
this.props.history.push('/mainPark');
});
let token = localStorage.getItem('test-token') || '';
fetch('http://10.58.2.215:8000/posting', {
method: 'POST',
headers: {
AUTHORIZATION: token,
},
})
.then((res) => res.json())
.then((data) => {
console.log(data);
});