How to catch and handle error response 422 with Redux/Axios?
问题 I have an action making a POST request to the server in order to update a user's password, but I'm unable to handle the error in the chained catch block. return axios({ method: 'post', data: { password: currentPassword, new_password: newPassword }, url: `path/to/endpoint` }) .then(response => { dispatch(PasswordUpdateSuccess(response)) }) .catch(error => { console.log('ERROR', error) switch (error.type) { case 'password_invalid': dispatch(PasswordUpdateFailure('Incorrect current password'))