diff --git a/src/middleware/AuthRoute.jsx b/src/middleware/AuthRoute.jsx index 1dee9d9..f57ec6e 100644 --- a/src/middleware/AuthRoute.jsx +++ b/src/middleware/AuthRoute.jsx @@ -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) {