Reactjs Axios响应显示状态代码200,但无响应数据
我是axios的新手。我正在尝试发送带有授权标头的post请求。在Post man中返回响应数据。但我在浏览器中看不到任何响应数据。请帮忙Reactjs Axios响应显示状态代码200,但无响应数据,reactjs,axios,react-hooks,Reactjs,Axios,React Hooks,我是axios的新手。我正在尝试发送带有授权标头的post请求。在Post man中返回响应数据。但我在浏览器中看不到任何响应数据。请帮忙 axios.post('http://13.127.3.151:8080/v1/dashboard/getuserdetails', { utype: "staff", uemail: "abdulwahidnasir@bitsathy.ac.in" }, { headers: { 'Authorization'
axios.post('http://13.127.3.151:8080/v1/dashboard/getuserdetails', {
utype: "staff",
uemail: "abdulwahidnasir@bitsathy.ac.in"
},
{ headers: { 'Authorization': `Bearer ${serviceToken}`,
'Content-Type': 'multipart/form-data' } })
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error.response)
});
我发现问题出在formData上。这个现在很好用
let formData = new FormData();
formData.append("utype", userType);
formData.append("uemail", email);
axios.post('http://13.127.3.151:8080/v1/dashboard/getuserdetails', formData,
{ headers: { 'Authorization': `Bearer ${serviceToken}`,
'Content-Type': 'multipart/form-data' } })
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error.response)
});
我发现问题出在formData上。这个现在很好用
let formData = new FormData();
formData.append("utype", userType);
formData.append("uemail", email);
axios.post('http://13.127.3.151:8080/v1/dashboard/getuserdetails', formData,
{ headers: { 'Authorization': `Bearer ${serviceToken}`,
'Content-Type': 'multipart/form-data' } })
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error.response)
});
“网络”选项卡显示什么?所有内容都在
响应.数据中DATALIST
是postman中len 1的数组,而axios请求中len 0的数组,但我认为axios.FYI没有问题。。你也向世界展示了无记名代币。一定要换。当您不知道自己在做什么时,这是有风险的。网络选项卡在数据列表中显示空响应承载令牌每3分钟过期一次网络选项卡显示什么?所有内容都在response.data
中DATALIST
是postman中len 1的数组,而axios请求中len 0的数组,但我认为axios.FYI没有问题。。你也向世界展示了无记名代币。一定要换。当您不知道自己在做什么时,这是有风险的。网络选项卡在数据列表中显示空响应。承载令牌每3分钟过期一次