Skip to content

Instantly share code, notes, and snippets.

@Cst2989
Last active January 22, 2022 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cst2989/a117597d8d085cd3739d839881fa9912 to your computer and use it in GitHub Desktop.
Save Cst2989/a117597d8d085cd3739d839881fa9912 to your computer and use it in GitHub Desktop.
try {
await AsyncStorage.setItem('@token', result.data.token);
const jsonValue = JSON.stringify(result.data);
await AsyncStorage.setItem('@user_Object', jsonValue);
} catch (e) {
console.log(e);
}
try {
const value = await AsyncStorage.getItem('@user_Object');
if (value !== null) {
const userObjectParsed = JSON.parse(value);
}
} catch (e) {
// error reading value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment