261012_01_FST: first commit

This commit is contained in:
2026-10-12 12:37:46 +09:00
commit 964269cd82
137 changed files with 17476 additions and 0 deletions

17
src/hooks/useStorage.ts Normal file
View File

@@ -0,0 +1,17 @@
"use client";
import { createStorageHook } from "@kri/common/hooks";
import type { AuthState } from "@/hooks/useAuth";
import { getLocalStorage, getSessionStorage, removeLocalStorage, removeSessionStorage, setLocalStorage, setSessionStorage } from "@/store/storage/secure-storage";
import { StorageKeys, StorageType } from "@/store/storage/storage-keys";
type AppStorageSchema = { [StorageKeys.AuthState]: AuthState };
type AppStorageKey = Extract<keyof AppStorageSchema, string>;
const useCommonStorage = createStorageHook<AppStorageSchema>({
resolveStorageScope: (key) => StorageType[key],
localStorageAdapter: { get: getLocalStorage, set: setLocalStorage, remove: removeLocalStorage },
sessionStorageAdapter: { get: getSessionStorage, set: setSessionStorage, remove: removeSessionStorage },
});
export const useStorage = <TKey extends AppStorageKey>(key: TKey) => useCommonStorage(key);