grafana/public/app/core/utils/auth.ts
Alexander Zobnin 75fd019068
ClientTokenRotation: Rotate only expired tokens (#74010)
* ClientTokenRotation: Rotate only expired tokens

* Don't expose getSessionExpiry
2023-08-30 13:43:52 +02:00

14 lines
315 B
TypeScript

export function getSessionExpiry() {
const expiryCookie = document.cookie.split('; ').find((row) => row.startsWith('grafana_session_expiry='));
if (!expiryCookie) {
return 0;
}
let expiresStr = expiryCookie.split('=').at(1);
if (!expiresStr) {
return 0;
}
return parseInt(expiresStr, 10);
}