mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 22:27:16 +01:00
Fixed goals query.
This commit is contained in:
parent
49bcbfd7f9
commit
f6c3ad5aa6
8 changed files with 38 additions and 30 deletions
|
|
@ -12,5 +12,6 @@ export function useReportQuery(reportId: string) {
|
|||
...data,
|
||||
});
|
||||
},
|
||||
enabled: !!reportId,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,23 +4,12 @@ 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({
|
||||
const { get } = useApi();
|
||||
|
||||
return 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,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export function usePagedQuery<T = any>({
|
|||
const { query: queryParams } = useNavigation();
|
||||
const [params, setParams] = useState<PageParams>({
|
||||
search: '',
|
||||
page: +queryParams.page || 1,
|
||||
page: +queryParams?.page || 1,
|
||||
});
|
||||
|
||||
const { useQuery } = useApi();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue