Skip to content

Commit

Permalink
frontend: fix adding another timeout to refresh the access token whic…
Browse files Browse the repository at this point in the history
…h leads to multiple requests beeing send with the same refresh token which then logs the user out. Fix #117
  • Loading branch information
ffreddow committed Oct 18, 2024
1 parent a98b69d commit cc5254d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,20 @@ async function refresh_access_token() {
logout(false);
}
loggedIn.value = AppState.LoggedIn;
setInterval(async () => {
await refresh_access_token();
}, 1000 * 60 * 5);
} else {
localStorage.removeItem("loginKey");
localStorage.removeItem("secretKey");
loggedIn.value = AppState.LoggedOut;
}
}

refresh_access_token();
refresh_access_token().then(() => {
if (loggedIn.value === AppState.LoggedIn) {
setInterval(async () => {
await refresh_access_token();
}, 1000 * 60 * 5);
}
});

localStorage.removeItem("secret_key");

Expand Down

0 comments on commit cc5254d

Please sign in to comment.