Skip to content

Instantly share code, notes, and snippets.

@gilankpam
Last active May 29, 2017 00:08
Show Gist options
  • Save gilankpam/c7ae1a57a0933a74cd906b59ee0eeb65 to your computer and use it in GitHub Desktop.
Save gilankpam/c7ae1a57a0933a74cd906b59ee0eeb65 to your computer and use it in GitHub Desktop.
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