【发布时间】:2020-11-03 14:36:24
【问题描述】:
当我尝试从 React 本机向我的 Spring Boot API 发出 axio post 请求时,我的数据没有被发送?
这是我在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))
)
}
【问题讨论】:
-
当我在 Spring Boot 应用程序中看到错误日志时,如下所示: Loading User Details for User: NONE_PROVIDED \\ 我认为这意味着它没有收到任何数据
标签: mysql spring-boot react-native post axios