Skip to content

Instantly share code, notes, and snippets.

@njwest
Created March 24, 2018 13:04
Show Gist options
  • Save njwest/f56bee187cb7a0bfd93a0bdbe6db1aec to your computer and use it in GitHub Desktop.
Save njwest/f56bee187cb7a0bfd93a0bdbe6db1aec to your computer and use it in GitHub Desktop.
services/deviceStorage.js loadJWT()
import { AsyncStorage } from 'react-native';
const deviceStorage = {
# code removed for brevity
async loadJWT() {
try {
const value = await AsyncStorage.getItem('id_token');
if (value !== null) {
this.setState({
jwt: value,
loading: false
});
} else {
this.setState({
loading: false
});
}
} catch (error) {
console.log('AsyncStorage Error: ' + error.message);
}
},
# snip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment