2017-05-10 10 views
0

Axiosリクエスト(Promise)を再生し、.thenで定義された関数を実行できますか?Axiosリプレイリクエスト.then()を含む約束

axios.interceptors.response.use(res => return res, err => { 
if(err.response.status === 401) { 
    // something like this, but so it would fire the .then on completion 
    return axios(err.config) 
} 
}) 

答えて

0

私はあなたがこの設定を行う必要があるかもしれないと思う:

validateStatus: function validateStatus(status) { 
    return status >= 200 && status < 300 || status == 401; 
    } 

ステータスが401であるときに、それは.thenで定義された関数を実行することができます。

関連する問題