[as] feat: dc service 추가
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type {
|
||||
NowDmgMtncGnsvyResponseDto,
|
||||
NowDmgMtncGnsvySearchDto,
|
||||
} from "../model/dc-interface";
|
||||
|
||||
async function getNowDmgMtncGnsvy(
|
||||
params: NowDmgMtncGnsvySearchDto,
|
||||
): Promise<NowDmgMtncGnsvyResponseDto[]> {
|
||||
const response = await client.get<NowDmgMtncGnsvyResponseDto[]>(
|
||||
ENDPOINT.DC_SERVICE.NOW_DMG_MTNC_GNSVY,
|
||||
{ params },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export { getNowDmgMtncGnsvy };
|
||||
@@ -0,0 +1,17 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type { NowDmgMtncGnsvySearchDto } from "../model/dc-interface";
|
||||
|
||||
import { getNowDmgMtncGnsvy } from "./dc-service";
|
||||
|
||||
export const nowDmgMtncGnsvyBaseKey = [ENDPOINT.DC_SERVICE.NOW_DMG_MTNC_GNSVY] as const;
|
||||
|
||||
export function useNowDmgMtncGnsvy(params: NowDmgMtncGnsvySearchDto) {
|
||||
return useQuery({
|
||||
queryKey: [...nowDmgMtncGnsvyBaseKey, params],
|
||||
queryFn: () => getNowDmgMtncGnsvy(params),
|
||||
enabled: Boolean(params.swtrmtFcltCd && params.ctpvNm),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user