Created
November 17, 2017 08:01
-
-
Save tapandave08/f0699d00f79ce6f9eefa339a00979930 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const fetchPOSTLOGIN = creds => { | |
return dispatch => { | |
dispatch({ type: LOGIN_REQUEST, payload: true }); | |
login(creds) | |
.then(user => { | |
sessionStorage.setItem("token", user.token); | |
dispatch({ type: LOGIN_SUCCESS, payload: user.token }); | |
history.push(`/dashboard`); | |
}) | |
.catch(err => { | |
dispatch( | |
errornotification(notification(errorcatc(err), "Error While Login")) | |
); | |
dispatch({ type: LOGIN_FAILURE }); | |
}); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment