SHARE
TWEET

Untitled

a guest Aug 25th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function* tokenCheck() {
  2.   const tokenStr = yield call(AsyncStorage.getItem, '@token');
  3.   if (!tokenStr) return null;
  4.   const token = JSON.parse(tokenStr);
  5.  
  6.   if (token) {
  7.     const { user } = yield call(ApiService.getUser, token.access_token);
  8.  
  9.     yield all([
  10.       put(tokenCreators.setToken(token)),
  11.       put(userCreators.setUser(user)),
  12.     ]);
  13.   }
  14.  
  15.   return token;
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top