From 060cbd81cddf5cec629515f2df56241de20fffc7 Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 23 Oct 2023 10:03:57 +0100 Subject: [PATCH] rename IndexedDB store --- src/store/IndexedDBStorage.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/store/IndexedDBStorage.ts b/src/store/IndexedDBStorage.ts index c8b9fd9..f9fe4c9 100644 --- a/src/store/IndexedDBStorage.ts +++ b/src/store/IndexedDBStorage.ts @@ -1,19 +1,22 @@ "use client"; -import { del, get, set } from "idb-keyval"; +import { createStore, del, get, set } from "idb-keyval"; import { StateStorage } from "zustand/middleware"; +const storage = createStore("scoresaber-reloaded", "storage"); + export const IDBStorage: StateStorage = { getItem: async (name: string): Promise => { //console.log(name, "has been retrieved"); - return (await get(name)) || null; + + return (await get(name, storage)) || null; }, setItem: async (name: string, value: string): Promise => { //console.log(name, "with value", value, "has been saved"); - await set(name, value); + await set(name, value, storage); }, removeItem: async (name: string): Promise => { //console.log(name, "has been deleted"); - await del(name); + await del(name, storage); }, };