Skip to content

Instantly share code, notes, and snippets.

@aire-con-gas
Created April 6, 2018 20:43
Show Gist options
  • Select an option

  • Save aire-con-gas/aca80b431d48708e228c5fcec0de3129 to your computer and use it in GitHub Desktop.

Select an option

Save aire-con-gas/aca80b431d48708e228c5fcec0de3129 to your computer and use it in GitHub Desktop.
case authActions.AuthActionTypes.RehydrateAuthState: {
let isLogged = false;
const role = localStorage.getItem('role') || null;
const token = localStorage.getItem('access_token');
const expires = parseInt(localStorage.getItem('expires'), 10);
const now = Date.now();
if ((now < expires) && token && role) {
isLogged = true;
}
// console.log(authActions.AuthActionTypes.RehydrateAuthState, isLogged );
return {
...state,
loggedIn: isLogged,
role: role
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment