지도 현재 만들어진것까지 수정 완료 추가로 만들것 확인해서 해야함
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import { fetchType, getFetchWithCount } from "@/components/lib/api";
|
||||
import { fetchType, getFetch, getFetchWithCount } from "@/components/lib/api";
|
||||
import type { CommonTableProps } from "../../common/type/header";
|
||||
import type { customRswtBdst } from "../../ruseFcltMng/fcltReg/rswtReg";
|
||||
import { rswtSttHeadListExport, rswtSttNodeListExport } from "../../ruseFcltMng/fcltSttn/rswtSttn/headList";
|
||||
import {
|
||||
rswtSttHeadListExport,
|
||||
rswtSttNodeListExport,
|
||||
} from "../../ruseFcltMng/fcltSttn/rswtSttn/headList";
|
||||
|
||||
|
||||
export const rswtMapSize = 15
|
||||
export const rswtMapSize = 15;
|
||||
export type rswtMapState = {
|
||||
rswtMap: {
|
||||
rswtMapRes: customRswtBdst[];
|
||||
@@ -16,8 +18,14 @@ export type rswtMapState = {
|
||||
};
|
||||
|
||||
type rswtMapActions = {
|
||||
rswtMapInit: (page: number, total: number, cityOrSgg:string) => void;
|
||||
rswtMapSearch: (page: number, total: number, cityOrSgg:string, searchTxt?:string) => void
|
||||
rswtMapInit: (page: number, total: number, cityOrSgg: string) => void;
|
||||
rswtMapSearch: (
|
||||
page: number,
|
||||
total: number,
|
||||
cityOrSgg: string,
|
||||
searchTxt?: string
|
||||
) => void;
|
||||
rswtMapDetile: (featureCd: string) => Promise<customRswtBdst | undefined>;
|
||||
};
|
||||
|
||||
export type rswtMapType = rswtMapState & rswtMapActions;
|
||||
@@ -36,15 +44,15 @@ export const rswtMapActionsExport: (set: any) => rswtMapActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
rswtMapInit: async (page: number, total: number, cityOrSgg:string) => {
|
||||
rswtMapInit: async (page: number, total: number, cityOrSgg: string) => {
|
||||
try {
|
||||
const rswtMapRes = await getFetchWithCount(
|
||||
fetchType.WR,
|
||||
`/reuseFc/waterreuseFc` +
|
||||
(page ? `/${page}` : "/1") +
|
||||
(total ? `/${total}` : "/20") +
|
||||
(cityOrSgg ? `/${cityOrSgg}` : "/0")
|
||||
);
|
||||
fetchType.WR,
|
||||
`/reuseFc/waterreuseFc` +
|
||||
(page ? `/${page}` : "/1") +
|
||||
(total ? `/${total}` : "/20") +
|
||||
(cityOrSgg ? `/${cityOrSgg}` : "/0")
|
||||
);
|
||||
|
||||
set((state: rswtMapState) => {
|
||||
return {
|
||||
@@ -61,7 +69,12 @@ export const rswtMapActionsExport: (set: any) => rswtMapActions = (
|
||||
console.log(e);
|
||||
}
|
||||
},
|
||||
rswtMapSearch: async (page: number, total: number, cityOrSgg:string, searchTxt?:string) => {
|
||||
rswtMapSearch: async (
|
||||
page: number,
|
||||
total: number,
|
||||
cityOrSgg: string,
|
||||
searchTxt?: string
|
||||
) => {
|
||||
try {
|
||||
const rswtMapRes = await getFetchWithCount(
|
||||
fetchType.WR,
|
||||
@@ -69,7 +82,7 @@ export const rswtMapActionsExport: (set: any) => rswtMapActions = (
|
||||
(page ? `/${page}` : "/1") +
|
||||
(total ? `/${total}` : "/20") +
|
||||
(cityOrSgg ? `/${cityOrSgg}` : "/0") +
|
||||
(searchTxt ? `/${searchTxt}` : "")
|
||||
(searchTxt ? `/${searchTxt}` : "")
|
||||
);
|
||||
|
||||
set((state: rswtMapState) => {
|
||||
@@ -86,6 +99,22 @@ export const rswtMapActionsExport: (set: any) => rswtMapActions = (
|
||||
console.log(e);
|
||||
}
|
||||
},
|
||||
rswtMapDetile: async (featureCd: string) => {
|
||||
try {
|
||||
const rswtDetail = await getFetch(
|
||||
fetchType.WR,
|
||||
`/reuseFc/waterreuseFc/1/3/0/${featureCd}`
|
||||
);
|
||||
|
||||
if (rswtDetail && rswtDetail.length > 0) {
|
||||
return rswtDetail[0];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
throw error; // 호출부에서 catch 가능하도록
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user