Created
September 11, 2017 18:08
-
-
Save diego3g/619f4404e24b6464ffdc269d24c2ef01 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
// src/services/auth.js | |
import { AsyncStorage } from 'react-native'; | |
export const TOKEN_KEY = "@RocketSeat:token"; | |
export const onSignIn = () => AsyncStorage.setItem(TOKEN_KEY, "true"); | |
export const onSignOut = () => AsyncStorage.removeItem(TOKEN_KEY); | |
export const isSignedIn = async () => { | |
const token = await AsyncStorage.getItem(TOKEN_KEY); | |
return (token !== null) ? true : false; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment