[as] WIP: 하수도기본계획 신청 페이지(이전기본계획조회)
This commit is contained in:
@@ -2,6 +2,11 @@ import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type {
|
||||
ClsfSystmRequestDto,
|
||||
ClsfSystmResponseDto,
|
||||
DcService,
|
||||
LvNowDmgMtncGnsvyResponseDto,
|
||||
LvNowDmgMtncGnsvySearchDto,
|
||||
NowDmgMtncGnsvyResponseDto,
|
||||
NowDmgMtncGnsvySearchDto,
|
||||
} from "../model/dc-interface";
|
||||
@@ -10,10 +15,31 @@ async function getNowDmgMtncGnsvy(
|
||||
params: NowDmgMtncGnsvySearchDto,
|
||||
): Promise<NowDmgMtncGnsvyResponseDto[]> {
|
||||
const response = await client.get<NowDmgMtncGnsvyResponseDto[]>(
|
||||
ENDPOINT.DC_SERVICE.NOW_DMG_MTNC_GNSVY,
|
||||
`${ENDPOINT.DC_SERVICE}/nowDmgMtncGnsvy`,
|
||||
{ params },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export { getNowDmgMtncGnsvy };
|
||||
async function getLvNowDmgMtncGnsvy(
|
||||
params: LvNowDmgMtncGnsvySearchDto,
|
||||
): Promise<LvNowDmgMtncGnsvyResponseDto[]> {
|
||||
const response = await client.get<LvNowDmgMtncGnsvyResponseDto[]>(
|
||||
`${ENDPOINT.DC_SERVICE}/lvNowDmgMtncGnsvy`,
|
||||
{ params },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function getClsfSystm(params: ClsfSystmRequestDto): Promise<ClsfSystmResponseDto[]> {
|
||||
const response = await client.get<ClsfSystmResponseDto[]>(`${ENDPOINT.DC_SERVICE}/clsfSystm`, {
|
||||
params,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export const dcService = {
|
||||
getNowDmgMtncGnsvy,
|
||||
getLvNowDmgMtncGnsvy,
|
||||
getClsfSystm,
|
||||
} satisfies DcService;
|
||||
|
||||
@@ -2,16 +2,35 @@ import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type { NowDmgMtncGnsvySearchDto } from "../model/dc-interface";
|
||||
import type {
|
||||
ClsfSystmRequestDto,
|
||||
LvNowDmgMtncGnsvySearchDto,
|
||||
NowDmgMtncGnsvySearchDto,
|
||||
} from "../model/dc-interface";
|
||||
|
||||
import { getNowDmgMtncGnsvy } from "./dc-service";
|
||||
import { dcService } from "./dc-service";
|
||||
|
||||
export const nowDmgMtncGnsvyBaseKey = [ENDPOINT.DC_SERVICE.NOW_DMG_MTNC_GNSVY] as const;
|
||||
export const baseKey = [ENDPOINT.DC_SERVICE] as const;
|
||||
|
||||
export function useNowDmgMtncGnsvy(params: NowDmgMtncGnsvySearchDto) {
|
||||
return useQuery({
|
||||
queryKey: [...nowDmgMtncGnsvyBaseKey, params],
|
||||
queryFn: () => getNowDmgMtncGnsvy(params),
|
||||
queryKey: [...baseKey, "nowDmgMtncGnsvy", params],
|
||||
queryFn: () => dcService.getNowDmgMtncGnsvy(params),
|
||||
enabled: Boolean(params.swtrmtFcltCd && params.ctpvNm),
|
||||
});
|
||||
}
|
||||
|
||||
export function useLvNowDmgMtncGnsvy(params: LvNowDmgMtncGnsvySearchDto) {
|
||||
return useQuery({
|
||||
queryKey: [...baseKey, "lvNowDmgMtncGnsvy", params],
|
||||
queryFn: () => dcService.getLvNowDmgMtncGnsvy(params),
|
||||
enabled: Boolean(params.level && params.ctpvNm && params.sggNm && params.gnsvyYr),
|
||||
});
|
||||
}
|
||||
|
||||
export function useClsfSystm(params: ClsfSystmRequestDto) {
|
||||
return useQuery({
|
||||
queryKey: [...baseKey, "clsfSystm", params],
|
||||
queryFn: () => dcService.getClsfSystm(params),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user