diff --git a/src/context/AppContext.js b/src/context/AppContext.js index eb7dd1403..9e4796327 100644 --- a/src/context/AppContext.js +++ b/src/context/AppContext.js @@ -205,11 +205,11 @@ export const AppProvider = (props) => { function checkSession() { const localToken = JSON.parse(localStorage.getItem('token')); const localUser = JSON.parse(localStorage.getItem('user')); - if (localToken && localUser) { + + if (localToken && localUser && session.token) { // Temporarily log in with the localStorage credentials while // we check that the session is still valid login(localUser, localToken); - axios .get( `${process.env.REACT_APP_API_ROOT}/auth/check_session?id=${localUser.id}`, @@ -232,6 +232,7 @@ export const AppProvider = (props) => { logout(); } }); + return true; } return false;