Skip to content

Commit

Permalink
set new time for session after session expiry
Browse files Browse the repository at this point in the history
  • Loading branch information
bo-lu committed Nov 5, 2024
1 parent aa0bd3c commit 35eec29
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/reducers/localStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export const loadState = (): StoreEnhancer<unknown, unknown> | undefined => {
// Check if the session has expired (5 minutes timeout)
const currentTime = new Date().getTime();
if (currentTime - parseInt(savedTime) > SESSION_TIMEOUT) {
console.log("NEW_SESSION_STARTED")
localStorage.clear(); // Invalidate state if session expired
localStorage.setItem('stateTimestamp', currentTime);
return undefined;
}

Expand Down

0 comments on commit 35eec29

Please sign in to comment.