Skip to content

best way to save what you love

web/session: add a delta to prevent token expiring on its way to api

wukko0e461d4ebe9d
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;
}