proper use of react-openapi for resource api calls
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user