Created
April 11, 2020 22:31
-
-
Save ICeZer0/c3136e74fa1d0ae5ab63941263a3a28f 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
const authContextValue = useMemo( | |
() => ({ | |
signIn: async data => { | |
if ( | |
data && | |
data.emailAddress !== undefined && | |
data.password !== undefined | |
) { | |
dispatch({ type: 'SIGN_IN', token: 'Token-For-Now' }); | |
} else { | |
dispatch({ type: 'TO_SIGNIN_PAGE' }); | |
} | |
}, | |
signOut: async data => { | |
dispatch({ type: 'SIGN_OUT' }); | |
}, | |
signUp: async data => { | |
if ( | |
data && | |
data.emailAddress !== undefined && | |
data.password !== undefined | |
) { | |
dispatch({ type: 'SIGNED_UP', token: 'dummy-auth-token' }); | |
} else { | |
dispatch({ type: 'TO_SIGNUP_PAGE' }); | |
} | |
} | |
}), | |
[] | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment