35 lines
856 B
TypeScript
35 lines
856 B
TypeScript
import { create } from "zustand";
|
|
import { getGeoData, getCmsData } from "@/components/lib/api";
|
|
import { fetchCtpvSggData, fetchBIZ_SE_CD, fetchBIZ_TY_CD } from "./index";
|
|
|
|
interface Option { id: number, name: string }
|
|
|
|
export type BIZ_CD_TYPE = {
|
|
lwpoCd: string,
|
|
upCd: string,
|
|
lwpoCdNm: string,
|
|
unit: string,
|
|
prntLwpoCd: null
|
|
};
|
|
|
|
interface SnStoreState {
|
|
ctpv: Option[];
|
|
sgg: Option[];
|
|
BIZ_SE_CD: BIZ_CD_TYPE[];
|
|
BIZ_TY_CD: BIZ_CD_TYPE[];
|
|
fetchCtpvSggData: () => Promise<void>;
|
|
fetchBIZ_SE_CD: () => Promise<void>;
|
|
fetchBIZ_TY_CD: () => Promise<void>;
|
|
}
|
|
|
|
const useStore = create<SnStoreState>((set) => ({
|
|
ctpv: [],
|
|
sgg: [],
|
|
BIZ_SE_CD: [],
|
|
BIZ_TY_CD: [],
|
|
fetchCtpvSggData: () => fetchCtpvSggData(set),
|
|
fetchBIZ_SE_CD: () => fetchBIZ_SE_CD(set),
|
|
fetchBIZ_TY_CD: () => fetchBIZ_TY_CD(set),
|
|
}));
|
|
|
|
export default useStore; |