Renamed query hooks. Fixed conversion bugs.

This commit is contained in:
Mike Cao committed 2025-03-22 03:48:18 -07:00
1 parent adca3c36d0
commit 7886c3f393
110 files changed
+423 -489

No files matched your search

@@ -0,0 +1,26 @@
import { useApi } from '../useApi';
import { usePagedQuery } from '../usePagedQuery';
import { useModified } from '../useModified';
export function useReportsQuery({ websiteId, teamId }: { websiteId?: string; teamId?: string }) {
const { modified } = useModified(`reports`);
const { get, del, useMutation } = useApi();
const queryResult = usePagedQuery({
queryKey: ['reports', { websiteId, teamId, modified }],
queryFn: (params: any) => {
return get('/reports', { websiteId, teamId, ...params });
},
});
const { mutate } = useMutation({ mutationFn: (reportId: string) => del(`/reports/${reportId}`) });
const deleteReport = (reportId: any) => {
mutate(reportId, {
onSuccess: () => {},
});
};
return {
...queryResult,
deleteReport,
};
}