rename IndexedDB store
Some checks failed
deploy / deploy (push) Failing after 28s

This commit is contained in:
Lee 2023-10-23 10:03:57 +01:00
parent a0aca8c9b1
commit 060cbd81cd

@ -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<string | null> => {
//console.log(name, "has been retrieved");
return (await get(name)) || null;
return (await get(name, storage)) || null;
},
setItem: async (name: string, value: string): Promise<void> => {
//console.log(name, "with value", value, "has been saved");
await set(name, value);
await set(name, value, storage);
},
removeItem: async (name: string): Promise<void> => {
//console.log(name, "has been deleted");
await del(name);
await del(name, storage);
},
};