feat: add savePortalSessions function

This commit is contained in:
Derrick Hammer 2023-10-19 17:04:15 -04:00
parent 98a6b48776
commit 2bc233c6b4
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 18 additions and 0 deletions

View File

@ -121,6 +121,24 @@ export function savePortals() {
}
}
export function savePortalSessions() {
const portalSessions = {};
for (const portal of ACTIVE_PORTALS) {
const jwt = portal.jwt;
if (jwt) {
portalSessions[portal[PORTAL_ID]] = jwt;
}
}
if (typeof globalThis.localStorage !== "undefined") {
globalThis.localStorage.setItem(
"portal_sessions",
JSON.stringify(portalSessions),
);
}
}
export function loadSavedPortals(): Portal[] | null {
let portals: string | null = null;