From 0e461d4ebe9d7da1a5a057776c23154d35ffad89 Mon Sep 17 00:00:00 2001 From: wukko Date: Sat, 17 Aug 2024 18:05:00 +0600 Subject: [PATCH] web/session: add a delta to prevent token expiring on its way to api --- web/src/lib/api/session.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/lib/api/session.ts b/web/src/lib/api/session.ts index 8f616d17..0e5c426a 100644 --- a/web/src/lib/api/session.ts +++ b/web/src/lib/api/session.ts @@ -45,7 +45,7 @@ export const getSession = async () => { const currentTime = Math.floor(new Date().getTime() / 1000); const cache = get(cachedSession); - if (cache?.token && cache?.exp > currentTime) { + if (cache?.token && cache?.exp - 2 > currentTime) { return cache; }