Merge branch 'authroute_bug_fix' of WrenchBoard/Users-Wrench into master
This commit is contained in:
@@ -34,6 +34,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
||||
window.addEventListener('keydown', resetTime)
|
||||
|
||||
const loadProfile = ()=>{ // function to load user profile
|
||||
setIsLogin({loading: true, status: false})
|
||||
apiCall.loadProfile().then((res)=>{
|
||||
if(res.data.internal_return < 0){
|
||||
setIsLogin({loading: false, status: false})
|
||||
@@ -50,7 +51,9 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
getProfile()
|
||||
if(!isLogin.status){
|
||||
getProfile()
|
||||
}
|
||||
|
||||
const checkInactivity = setInterval(() => {
|
||||
if (Date.now() - lastActivityTime > process.env.REACT_APP_SESSION_EXPIRE_MINUTES) {
|
||||
|
||||
Reference in New Issue
Block a user