From 393eed4288981000e0092e591017aa15e521144a Mon Sep 17 00:00:00 2001 From: rivery Date: Mon, 16 Jan 2023 17:16:24 +0800 Subject: [PATCH] feat: update config info --- src/utils/index.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/utils/index.ts b/src/utils/index.ts index cdfe8a18..7174cdcb 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -69,6 +69,23 @@ export class SessionStorageUtil { } } +export class LocalStorageStorageUtil { + static setItem(key: string, value: T) { + localStorage.setItem(key, JSON.stringify(value)); + } + + static getItem(key: string): T | undefined { + const item = localStorage.getItem(key); + if (item) { + return JSON.parse(item); + } + } + + static removeItem(key: string) { + localStorage.removeItem(key); + } +} + export const clearNebulaConnection = () => { SessionStorageUtil.removeItem('nebulaConnect'); cookies.remove('nsid');