[st] refactor: 시도/시군구 셀렉트 API 변경

This commit is contained in:
2026-03-23 11:45:34 +09:00
parent 1728d1879c
commit a46b185c16
8 changed files with 122 additions and 80 deletions
@@ -2,8 +2,28 @@ import { useQuery } from "@tanstack/react-query";
import { ENDPOINT } from "@/shared/config";
import { stAnlsMstApi } from "./statistics-analysis-master-api";
import { stAnlsRsltApi } from "./statistics-analysis-result-api";
export const useStAnlsSidoCombo = () => {
return useQuery({
queryKey: [ENDPOINT.STATVERIFY_SERVICE.ST_ANLS_MST, "sido"],
queryFn: () => stAnlsMstApi.getSidoCombo(),
});
};
export const useStAnlsSigunguCombo = (sidoCd: string) => {
return useQuery({
queryKey: [
ENDPOINT.STATVERIFY_SERVICE.ST_ANLS_MST,
"sigungu",
sidoCd,
],
queryFn: () => stAnlsMstApi.getSigunguCombo(sidoCd),
enabled: Boolean(sidoCd),
});
};
export const useStAnlsRsltList = (
anlsSn: number,
vrfcTrgtSn: string | null,
@@ -21,6 +41,7 @@ export const useStAnlsRsltList = (
vrfcTrgtSn: Number(vrfcTrgtSn),
page: 0,
size: 1000,
sort: "admdstCd,asc",
}),
enabled: !!anlsSn && !!vrfcTrgtSn,
});
@@ -2,12 +2,13 @@ import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type {
AdstZoneResponseDto,
StAnlsMstListApiResponse,
StAnlsMstSearchParams,
StAnlsOutlierListResponse,
} from "../model/statistics-analysis/statistics-analysis-master-interface";
export class AnalysisHistoryApiService {
export class StAnlsMstApiService {
public async getAnalysisHistoryList(
params: StAnlsMstSearchParams,
): Promise<StAnlsMstListApiResponse> {
@@ -30,6 +31,23 @@ export class AnalysisHistoryApiService {
return response.data;
}
public async getSidoCombo(): Promise<AdstZoneResponseDto[]> {
const response = await client.get<AdstZoneResponseDto[]>(
`${ENDPOINT.STATVERIFY_SERVICE.ST_ANLS_MST}/sido`,
);
return response.data;
}
public async getSigunguCombo(sidoCd: string): Promise<AdstZoneResponseDto[]> {
const response = await client.get<AdstZoneResponseDto[]>(
`${ENDPOINT.STATVERIFY_SERVICE.ST_ANLS_MST}/sigungu`,
{ params: { sidoCd } },
);
return response.data;
}
}
export const analysisHistoryApi = new AnalysisHistoryApiService();
export const stAnlsMstApi = new StAnlsMstApiService();