From d8b3ea39023bfb23afd076f88d6882bf3920d7bd Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Wed, 11 Sep 2024 18:43:03 +0200 Subject: [PATCH] spot: login state check --- frontend/app/Router.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/app/Router.tsx b/frontend/app/Router.tsx index 74ed041db..e440b57d2 100644 --- a/frontend/app/Router.tsx +++ b/frontend/app/Router.tsx @@ -167,10 +167,12 @@ const Router: React.FC = (props) => { useEffect(() => { if (isLoggedIn && (location.pathname.includes('login') || isSpotCb)) { - if (localSpotJwt && !isTokenExpired(localSpotJwt)) { - handleSpotLogin(localSpotJwt); - } else { - logout(); + if (localSpotJwt) { + if (!isTokenExpired(localSpotJwt)) { + handleSpotLogin(localSpotJwt); + } else { + logout(); + } } } }, [isSpotCb, location, isLoggedIn, localSpotJwt])