Fixed mutate queries.

This commit is contained in:
Mike Cao 2023-12-03 21:35:20 -08:00
parent e462a55ab9
commit a4f8ab6ad9
4 changed files with 20 additions and 14 deletions

View file

@ -12,12 +12,12 @@ export function ReportHeader({ icon }) {
const { showToast } = useToasts();
const { post, useMutation } = useApi();
const router = useRouter();
const { mutate: create, isLoading: isCreating } = useMutation((data: any) =>
post(`/reports`, data),
);
const { mutate: update, isLoading: isUpdating } = useMutation((data: any) =>
post(`/reports/${data.id}`, data),
);
const { mutate: create, isPending: isCreating } = useMutation({
mutationFn: (data: any) => post(`/reports`, data),
});
const { mutate: update, isPending: isUpdating } = useMutation({
mutationFn: (data: any) => post(`/reports/${data.id}`, data),
});
const { name, description, parameters } = report || {};
const { websiteId, dateRange } = parameters || {};