Fix parsing storage value

Regression ef6c1fce56
This commit is contained in:
schroda
2025-07-28 20:56:36 +02:00
parent ed2d60dd1c
commit 7eb3b0ac45

View File

@@ -7,6 +7,8 @@
*/ */
// eslint-disable-next-line max-classes-per-file // eslint-disable-next-line max-classes-per-file
import { jsonSaveParse } from '@/lib/HelperFunctions.ts';
export class Storage { export class Storage {
constructor(private readonly storage: typeof window.localStorage) {} constructor(private readonly storage: typeof window.localStorage) {}
@@ -15,11 +17,7 @@ export class Storage {
return defaultValue; return defaultValue;
} }
if (typeof defaultValue === 'string') { return jsonSaveParse(value) ?? (value as T);
return value as T;
}
return JSON.parse(value);
} }
getItem(key: string): string | null { getItem(key: string): string | null {