当我尝试从 React 本机向我的 Spring Boot API 发出 axio 发布请求时,我的数据没有被发送?
这是我的apiReq
函数代码:
const apiReq = () => {
return (axios.post('http://{IP address}:8082/api/login', {
headers: {
"Accept": 'application/json',
"Content-Type": "application/json"
},
body: JSON.stringify({
"password": "#####",
"username": "abcd.gmail.com"
})
})
.then(response => {
console.log(response.data.responseMessage.errorCode);
})
.then(result => console.log(result))
.catch(error => console.log('error', error))
)
}