使用eact本机获取数据



我正试图从django数据库中获取我的用户信息。但我只收到以下消息

{"_bodyBlob": {"_data": {"__collector": [Object], "blobId": "ee5e4317-5bb7-4b5f-8e19-7a787cdee766", "offset": 0, "size": 94}}, "_bodyInit": {"_data": {"__collector": [Object], "blobId": "ee5e4317-5bb7-4b5f-8e19-7a787cdee766", "offset": 0, "size": 94}}, "bodyUsed": false, "headers": {"map": {"allow": "GET, POST, HEAD, OPTIONS", "content-length": "94", "content-type": "application/json", "date": "Sat, 19 Mar 2022 22:02:40 GMT", "referrer-policy": "same-origin", "server": "WSGIServer/0.2 CPython/3.6.8", "vary": "Accept, Origin, Cookie", "x-content-type-options": "nosniff", "x-frame-options": "DENY"}}, "ok": true, "status": 200, "statusText": "", "type": "default"

我可以使用它来确定状态是否可以长期使用,但我希望能够收集用户信息并将其发送到下一页。

有什么帮助吗?

我能够通过使用异步函数来解决这个问题。

fetch('http://XXXXXX/api/userprofile',{
method  : 'GET',
header : {
Accept  : 'application/json',
'Content-Type' : 'application/json'
} 
}).then(async res =>{ 
const response =await res.json() 
console.log(response)
})

最新更新