I'm trying to catch 401 error in the error callback of axios (I just want to detect that it's a 401 error) , but it doesn't has any attribute that indicate about 401 .
i.e -
test401() {
var self = this;
axios.post('https://mail.google.com/sync/u/0/i/fd?hl=en&c=12')
.catch( (error) => {
self.setState({data: error.status || "No Status" });
console.log("catch ", error); // No any status here
});
}
Here is the jsfiddler if you want to check it
How could I know in axios that I got 401 error response ?