matrix-art

An image gallery for Matrix
git clone git://archive.git.mtrnord.blog/MTRNord/matrix-art.git
Log | Files | Refs | README | LICENSE

commit 501ea9fe72d7ad3f1f251ac93f01079ea1df1203
parent 1f4931bc1e6156a3ad7e87f7b8683e3ff53a1e8e
Author: MTRNord <mtrnord1@gmail.com>
Date:   Mon,  7 Feb 2022 18:26:22 +0100

Move version check to the functions to hopefully make the build work

Diffstat:
Mhelpers/storage.ts | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/helpers/storage.ts b/helpers/storage.ts @@ -16,13 +16,14 @@ export default class Storage { } this.nodeLocalStorage = new LocalStorage(dir); } + } + private ensureVersion() { let version; if (typeof window !== "undefined") { version = window.localStorage.getItem("version"); } else { version = this.nodeLocalStorage?.getItem("version"); } - console.log("storage_version:", version); if (version === undefined || version === null || version !== STORAGE_VERSION.toString()) { if (typeof window !== "undefined") { window.localStorage.clear(); @@ -33,7 +34,9 @@ export default class Storage { } } } + getItem(key: string): any { + this.ensureVersion(); if (typeof window !== "undefined") { return window.localStorage.getItem(this.prefix + key); } else { @@ -42,6 +45,7 @@ export default class Storage { } setItem(key: string, value: any): any { + this.ensureVersion(); if (typeof window !== "undefined") { return window.localStorage.setItem(this.prefix + key, value); } else { @@ -50,6 +54,7 @@ export default class Storage { } removeItem(key: string): any { + this.ensureVersion(); if (typeof window !== "undefined") { return window.localStorage.removeItem(this.prefix + key); } else {