1
我有一個axios的問題。即使請求以200退還,承諾總是被拒絕。axios返回錯誤狀態200
let params = new URLSearchParams();
params.append('email', credentials.email);
params.append('password', credentials.password);
params.append('grant_type', 'email');
params.append('scope', 'read write');
let promise = axios.post('/backend/oauth/token', params, {
headers: {
'Accept': 'application/json'
}
}).then((response) => {
console.log(response);
let loginData = response.data;
let expiredAt;
expiredAt = new Date;
expiredAt.setSeconds(expiredAt.getSeconds() + loginData.expires_in);
loginData.expires_at = expiredAt.getTime();
store.set('token', loginData);
}, (err) => {
console.log("LOL");
console.log(err);
});
錯誤函數總是被調用,並且err對象的狀態爲'200',statusText:'ok'。難道我做錯了什麼?