How to catch status = cancelled in axios? How to catch status = cancelled in axios? express express

How to catch status = cancelled in axios?


use axios.isCancel()

.catch(err => {       if(axios.isCancel(err)) {        // do something      }   })


You actually catch errors(unsuccessful responses) in catch statement. You can for example log it to console like this:

.catch(err => {        // If there was a problem, we want to        // dispatch the error condition        dispatch(loginError(err.data));        console.log(err);        return err;      });