how to handle 401 Unauthorized status code with Axios Interceptor. This snippet print error in console but I still get RED error code in console, how to remove it?
axios.interceptors.response.use(
response => {
console.log("Axios Response: ", response);
return response;
},
error => {
if (error.response.status === 401) {
console.log("RESPONSE 401");
return Promise.reject(error.response);
}
console.log("Axios Response Error: ", error.response);
return Promise.reject(error);
} );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.