/** * ๐Ÿ“„ useStore * SN ์•ฑ Zustand ์Šคํ† ์–ด * * - ์‹œ๋„ ๋ฐ์ดํ„ฐ ์ƒํƒœ ๊ด€๋ฆฌ ๋ฐ ์กฐํšŒ ๊ธฐ๋Šฅ * - ์‹œ๊ตฐ๊ตฌ ๋ฐ์ดํ„ฐ ์ƒํƒœ ๊ด€๋ฆฌ ๋ฐ ์กฐํšŒ ๊ธฐ๋Šฅ * - ์‚ฌ์—… ๊ตฌ๋ถ„ ์ฝ”๋“œ ์ƒํƒœ ๊ด€๋ฆฌ ๋ฐ ์กฐํšŒ ๊ธฐ๋Šฅ * - ์‚ฌ์—… ์œ ํ˜• ์ฝ”๋“œ ์ƒํƒœ ๊ด€๋ฆฌ ๋ฐ ์กฐํšŒ ๊ธฐ๋Šฅ * - Zustand๋ฅผ ํ†ตํ•œ ์ค‘์•™ ์ง‘์ค‘์‹ ์ƒํƒœ ๊ด€๋ฆฌ * - ๋ฐ์ดํ„ฐ ๋ณ€๊ฒฝ ๊ฐ์ง€ ๋ฐ ๋ถˆํ•„์š”ํ•œ ์žฌ๋ Œ๋”๋ง ๋ฐฉ์ง€ */ import { create } from "zustand"; import { fetchCtpv, fetchSgg, fetchBIZ_SE_CD, fetchBIZ_TY_CD } from "./index"; import { type SelectDataType } from "@common/business_components"; export type BIZ_CD_TYPE = { lwpoCd: string, upCd: string, lwpoCdNm: string, unit: string, prntLwpoCd: null }; interface SnStoreState { ctpv: SelectDataType[]; sgg: SelectDataType[]; BIZ_SE_CD: BIZ_CD_TYPE[]; BIZ_TY_CD: BIZ_CD_TYPE[]; fetchCtpv: () => Promise; fetchSgg: () => Promise; fetchBIZ_SE_CD: () => Promise; fetchBIZ_TY_CD: () => Promise; } const useStore = create((set) => ({ ctpv: [], sgg: [], BIZ_SE_CD: [], BIZ_TY_CD: [], fetchCtpv: () => fetchCtpv(set), fetchSgg: () => fetchSgg(set), fetchBIZ_SE_CD: () => fetchBIZ_SE_CD(set), fetchBIZ_TY_CD: () => fetchBIZ_TY_CD(set), })); export default useStore;