Created
January 31, 2018 10:50
Action Type
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
// There are three possible states for our login | |
// process and we need actions for each of them | |
export const LOGIN_REQUEST = 'LOGIN_REQUEST' | |
export const LOGIN_SUCCESS = 'LOGIN_SUCCESS' | |
export const LOGIN_FAILURE = 'LOGIN_FAILURE' | |
function requestLogin(creds) { | |
return { | |
type: LOGIN_REQUEST, | |
isFetching: true, | |
isAuthenticated: false, | |
creds | |
} | |
} | |
function receiveLogin(user) { | |
return { | |
type: LOGIN_SUCCESS, | |
isFetching: false, | |
isAuthenticated: true, | |
id_token: user.id_token | |
} | |
} | |
function loginError(message) { | |
return { | |
type: LOGIN_FAILURE, | |
isFetching: false, | |
isAuthenticated: false, | |
message | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment