diff options
Diffstat (limited to 'packages/client/src/store.ts')
| -rw-r--r-- | packages/client/src/store.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/client/src/store.ts b/packages/client/src/store.ts index b9800ec607..296eaa2068 100644 --- a/packages/client/src/store.ts +++ b/packages/client/src/store.ts @@ -286,6 +286,16 @@ export class ColdDeviceStorage { } } + public static getAll(): Partial<typeof this.default> { + return (Object.keys(this.default) as (keyof typeof this.default)[]).reduce((acc, key) => { + const value = localStorage.getItem(PREFIX + key); + if (value != null) { + acc[key] = JSON.parse(value); + } + return acc; + }, {} as any); + } + public static set<T extends keyof typeof ColdDeviceStorage.default>(key: T, value: typeof ColdDeviceStorage.default[T]): void { localStorage.setItem(PREFIX + key, JSON.stringify(value)); |