Compute refresh token expiry fresh on each sign-in

The expiry date was computed once at store init time and went stale
in long-running SPA sessions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 17:49:14 +08:00
parent ba7c1c7cd0
commit 5b3130ea9c
2 changed files with 3 additions and 14 deletions

View File

@@ -249,16 +249,4 @@ describe('loginStore', () => {
});
});
describe('expired', () => {
it('is approximately 6 months in the future', () => {
const now = new Date();
const sixMonthsLater = new Date(now);
sixMonthsLater.setMonth(sixMonthsLater.getMonth() + 6);
const expiredDate = new Date(store.expired);
// Allow 1 day tolerance
const diffMs = Math.abs(expiredDate.getTime() - sixMonthsLater.getTime());
expect(diffMs).toBeLessThan(24 * 60 * 60 * 1000);
});
});
});