mirror of
https://github.com/wukko/cobalt.git
synced 2025-05-11 11:14:27 +02:00
web/session: add a delta to prevent token expiring on its way to api
This commit is contained in:
parent
9592e59f76
commit
0e461d4ebe
@ -45,7 +45,7 @@ export const getSession = async () => {
|
|||||||
const currentTime = Math.floor(new Date().getTime() / 1000);
|
const currentTime = Math.floor(new Date().getTime() / 1000);
|
||||||
const cache = get(cachedSession);
|
const cache = get(cachedSession);
|
||||||
|
|
||||||
if (cache?.token && cache?.exp > currentTime) {
|
if (cache?.token && cache?.exp - 2 > currentTime) {
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user