fix: switch to using globalThis, and check if we have localStorage (if not, might be node)
This commit is contained in:
parent
2d9167fe33
commit
79273d263b
|
@ -75,7 +75,11 @@ export function initPortal(portal: Portal): Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPortalSessions() {
|
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 = {};
|
let portalSessions: PortalSessionsStore = {};
|
||||||
if (portalSessions) {
|
if (portalSessions) {
|
||||||
portalSessions = JSON.parse(
|
portalSessions = JSON.parse(
|
||||||
|
|
Loading…
Reference in New Issue