fix: switch to using globalThis, and check if we have localStorage (if not, might be node)

This commit is contained in:
Derrick Hammer 2023-06-26 02:07:03 -04:00
parent 2d9167fe33
commit 79273d263b
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 1 deletions

View File

@ -75,7 +75,11 @@ export function initPortal(portal: Portal): Client {
}
export function getPortalSessions() {
let portalSessionsData = window.localStorage.getItem("portals");
if (typeof globalThis.localStorage === "undefined") {
return undefined;
}
let portalSessionsData = globalThis.localStorage.getItem("portals");
let portalSessions: PortalSessionsStore = {};
if (portalSessions) {
portalSessions = JSON.parse(