proper use of react-openapi for resource api calls

This commit is contained in:
2026-04-25 12:13:28 +05:30
parent 5acbb7ccdd
commit 71afc157ff
13 changed files with 191 additions and 222 deletions

View File

@@ -1,5 +1,4 @@
import { useQuery } from "@tanstack/react-query";
import { fetchReport } from "./report.api";
import { useResourceByName } from "../../../react-openapi";
export interface ReportParams {
period: "weekly" | "monthly" | "yearly" | "fyly";
@@ -10,8 +9,6 @@ export interface ReportParams {
}
export function useReport(params: ReportParams) {
return useQuery({
queryKey: ["report", params],
queryFn: () => fetchReport(params),
});
const { useList } = useResourceByName("reports");
return useList(params);
}