I'm trying to update a react redux node with jwt auth setup and trying to figure out why this code for password reset functionality:
/**
* Reset password
*/
export function resetPassword(props) {
return function (dispatch) {
axios.post(`${API_URL}/reset-password`, props)
.then(() => {
dispatch({ type: RESET_PASSWORD_SUCCESS });
history.push(`/reduxauth/reset-password/verify?email=${props.email}`);
// browserHistory.push(`/reduxauth/reset-password/verify?email=${props.email}`); default
})
.catch(response => {
dispatch(authError(RESET_PASSWORD_FAILURE, response.data.error))
});
}
}
keeps giving me this error: Uncaught (in promise) TypeError: Cannot read property 'error' of undefined
its referring to response.data.error
in .catch
above
I can't figure out why data is undefined?