33 lines
1001 B
TypeScript
33 lines
1001 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
|
|
import { ENDPOINT } from "@/shared/config";
|
|
|
|
import type {
|
|
DashboardMainSearchDto,
|
|
InPrgrsDocPicResponseDto,
|
|
} from "../model/dashboard-interface";
|
|
|
|
import { dashboardService } from "./dashboard-service";
|
|
|
|
export const dashboardBaseKey = [ENDPOINT.AS_SERVICE.DASHBOARD] as const;
|
|
|
|
const EMPTY_SEARCH: DashboardMainSearchDto = {};
|
|
|
|
export function useGetMainDashboard(params: DashboardMainSearchDto = EMPTY_SEARCH) {
|
|
return useQuery({
|
|
queryKey: [...dashboardBaseKey, "getMainDashboard", params],
|
|
queryFn: () => dashboardService.getMainDashboard(params),
|
|
});
|
|
}
|
|
|
|
export function useGetInPrgrsDocPicList<TData = InPrgrsDocPicResponseDto[]>(
|
|
searchYear?: number,
|
|
options?: { select?: (data: InPrgrsDocPicResponseDto[]) => TData },
|
|
) {
|
|
return useQuery({
|
|
queryKey: [...dashboardBaseKey, "getInPrgrsDocPicList", searchYear],
|
|
queryFn: () => dashboardService.getInPrgrsDocPicList(searchYear),
|
|
select: options?.select,
|
|
});
|
|
}
|