在我的傳奇中,我將用戶憑據發送到后端
const request = client.post('api/JwtAuth/GenerateToken', {UserName: action.username, Password: action.password})
console.log(request)
客戶看起來像這樣
從“axios”匯入 axios
const client = axios.create({
baseURL: 'https://localhost:5001/',
timeout: 600000000000,
headers: {
ContentType: 'application/json'
}
})
export default client

uj5u.com熱心網友回復:
const request = client.post('api/JwtAuth/GenerateToken', {UserName:
action.username, Password: action.password})
request.then(response => {
// the response body can be accessed through the "data" property
console.log(response.data)
})
console.log(request)
uj5u.com熱心網友回復:
你的問題是什么?如果問題為什么您會在控制臺上看到 Promise?那是因為您正在處理承諾,要么使用 .then
client.post().then(res => console.log(res.data)).catch(err => console.log(err))
或異步等待語法
await client.post()
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/358597.html
上一篇:在MicrosoftSQLServer中以正確排列或連續的方式處理此分配以獲取日期的正確方法是什么?
下一篇:從字串中獲取有效載荷
