Created
April 6, 2018 20:43
-
-
Save aire-con-gas/aca80b431d48708e228c5fcec0de3129 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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