new report structure
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
import { useResourceByName } from "../../../react-openapi";
|
||||
|
||||
export interface ReportParams {
|
||||
period: "weekly" | "monthly" | "yearly" | "fyly" | "full";
|
||||
periods?: ("weekly" | "monthly" | "yearly" | "fyly" | "full")[];
|
||||
rolling?: boolean;
|
||||
report_date?: string;
|
||||
group_by?: ("payee" | "tags")[];
|
||||
ignore_self?: boolean;
|
||||
include_transactions?: boolean;
|
||||
}
|
||||
|
||||
export function useReport(params: ReportParams) {
|
||||
const { useList } = useResourceByName("reports");
|
||||
if (params.group_by) {
|
||||
// @ts-ignore
|
||||
params.group_by = params.group_by[0]
|
||||
}
|
||||
return useList(params);
|
||||
}
|
||||
|
||||
return useList({
|
||||
...params,
|
||||
periods: params.periods,
|
||||
group_by: params.group_by,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user