feat: Store SN Root 경로에서 사용하도록 수정중 (추가 작업 필요)

This commit is contained in:
swcho
2025-08-01 16:44:08 +09:00
parent 19cae3fd03
commit 406826a11b
7 changed files with 132 additions and 27 deletions
+1
View File
@@ -2,5 +2,6 @@ export { useMutationWrapper } from "./use-mutation-wrapper";
export { useAlertStore } from "./use-alert-store";
export { useMenuStore } from "./use-menu-store";
export { useUserStore } from "./use-user-store";
export { useDataStore } from "./use-data-store";
export { usePrompt } from "./use-prompt";
export { getCookie, setCookie, removeCookie } from "./cookie";
+14
View File
@@ -0,0 +1,14 @@
import { useStore } from "zustand";
import { useContext } from "react";
import type { DataStore } from "../store/data-store";
import { StoreContext } from "../providers/store-provider";
export const useDataStore = <T>(selector: (store: DataStore) => T): T => {
const storeContext = useContext(StoreContext);
if (!storeContext) {
throw new Error("useDataStore must be used within StoreProvider");
}
return useStore(storeContext.dataStore, selector);
};