Last active
May 29, 2017 00:08
-
-
Save gilankpam/c7ae1a57a0933a74cd906b59ee0eeb65 to your computer and use it in GitHub Desktop.
This file contains 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
function login(username, password) { | |
return dispatch => { | |
dispatch({ | |
type: 'LOGIN_REQUEST' | |
}) | |
api.login(username, password) | |
.then(user => dispatch({ | |
type: 'LOGIN_SUCCESS', | |
user | |
})) | |
.catch(error => dispatch({ | |
type: 'LOGIN_FAILURE', | |
error | |
})) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment