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

This commit is contained in:
wukko 2024-08-17 18:05:00 +06:00
parent 9592e59f76
commit 0e461d4ebe
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

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