spot: login state check

This commit is contained in:
nick-delirium 2024-09-11 18:43:03 +02:00
parent 2253ac394d
commit d8b3ea3902
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0

View file

@ -167,10 +167,12 @@ const Router: React.FC<RouterProps> = (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])