diff --git a/web/packages/shared/storage/sessionStorage/index.ts b/web/packages/shared/storage/sessionStorage/index.ts index bbd531d71..b3de32d69 100644 --- a/web/packages/shared/storage/sessionStorage/index.ts +++ b/web/packages/shared/storage/sessionStorage/index.ts @@ -3,31 +3,14 @@ export enum SESSION_KEYS { KEY_ENCRYPTION_KEY = "keyEncryptionKey", } -export const setKey = (key: SESSION_KEYS, value: object) => { - if (typeof sessionStorage === "undefined") { - return null; - } +export const setKey = (key: SESSION_KEYS, value: object) => sessionStorage.setItem(key, JSON.stringify(value)); -}; export const getKey = (key: SESSION_KEYS) => { - if (typeof sessionStorage === "undefined") { - return null; - } const value = sessionStorage.getItem(key); return value && JSON.parse(value); }; -export const removeKey = (key: SESSION_KEYS) => { - if (typeof sessionStorage === "undefined") { - return null; - } - sessionStorage.removeItem(key); -}; +export const removeKey = (key: SESSION_KEYS) => sessionStorage.removeItem(key); -export const clearKeys = () => { - if (typeof sessionStorage === "undefined") { - return null; - } - sessionStorage.clear(); -}; +export const clearKeys = () => sessionStorage.clear();