29 lines
991 B
TypeScript
29 lines
991 B
TypeScript
import { fetchType, getFetch, postFectch } from "@/components/lib/api"
|
|
import type { pubHasuType } from "../../ruseFcltMng/fcltReg/pbnstReg/type"
|
|
export type comFcltState = {
|
|
searchFclts: pubHasuType
|
|
}
|
|
export type comFcltActions = {
|
|
getSwtrmtFcltNm: (searchNm: string) => void
|
|
}
|
|
|
|
export const searchActions: (set: any) => comFcltActions = (set: any) => {
|
|
return {
|
|
getSwtrmtFcltNm: async (searchNm: string) => {
|
|
const fcltNm = await getFetch("common", `/prcsFclt/info/1/20/${searchNm}`);
|
|
const fcltNmCd: pubHasuType[] = fcltNm.map((item: any) => ({
|
|
bscFctCd: item.bscFctCd,
|
|
sido: item.sido,
|
|
gugun: item.gugun,
|
|
bscFctNm: item.bscFctNm,
|
|
addr: item.addr,
|
|
fctCpc: item.fctCpc
|
|
}))
|
|
return set((state: comFcltState) => ({
|
|
...state,
|
|
searchFclts: fcltNmCd
|
|
}
|
|
))
|
|
},
|
|
}
|
|
} |