count
This commit is contained in:
@@ -9,17 +9,35 @@ export const useCreateInvoice = () => {
|
||||
mutationFn: api.createInvoice,
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ["invoice"] });
|
||||
queryClient.invalidateQueries({ queryKey: ["invoice-tab-counts"] });
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetInvoice = (params: api.GetInvoicesParams) => {
|
||||
return useQuery({
|
||||
queryKey: ["invoice", params.page, params.statuses?.join(",") ?? ""],
|
||||
queryKey: [
|
||||
"invoice",
|
||||
params.page,
|
||||
params.statuses?.join(",") ?? "",
|
||||
params.search ?? "",
|
||||
params.from ?? "",
|
||||
params.to ?? "",
|
||||
],
|
||||
queryFn: () => api.getInvoice(params),
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetInvoiceTabCounts = (
|
||||
params?: api.GetInvoiceTabCountsParams,
|
||||
) => {
|
||||
return useQuery({
|
||||
queryKey: ["invoice-tab-counts", params],
|
||||
queryFn: () => api.getInvoiceTabCounts(params),
|
||||
refetchInterval: 20_000,
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetInvoiceDetail = (id: string | undefined) => {
|
||||
return useQuery({
|
||||
queryKey: ["invoice", id],
|
||||
@@ -49,6 +67,7 @@ export const useUpdateInvoice = () => {
|
||||
}) => api.updateInvoice(id, params),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ["invoice"] });
|
||||
queryClient.invalidateQueries({ queryKey: ["invoice-tab-counts"] });
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -60,6 +79,7 @@ export const useArchiveInvoice = () => {
|
||||
mutationFn: (id: string) => api.archiveInvoice(id),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ["invoice"] });
|
||||
queryClient.invalidateQueries({ queryKey: ["invoice-tab-counts"] });
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user