.
This commit is contained in:
parent
cef7536f27
commit
2403e1ca0a
@ -23,7 +23,7 @@ export const useProformaDeleteMutation = () => {
|
||||
mutationKey: DELETE_PROFORMA_MUTATION_KEY,
|
||||
mutationFn: async ({ id, signal }) => {
|
||||
if (!id) {
|
||||
throw new Error("customerId is required");
|
||||
throw new Error("proformaId is required");
|
||||
}
|
||||
|
||||
await deleteProformaById(dataSource, { id, signal });
|
||||
@ -32,12 +32,11 @@ export const useProformaDeleteMutation = () => {
|
||||
onMutate: async ({ id }) => {
|
||||
return prepareDeleteProformaOptimisticUpdate(queryClient, id);
|
||||
},
|
||||
|
||||
onError: (_error, _params, context) => {
|
||||
rollbackDeleteProformaOptimisticUpdate(queryClient, context);
|
||||
},
|
||||
onSuccess: ({ id }) => {
|
||||
finalizeDeletedProformaCaches(queryClient, id);
|
||||
},
|
||||
|
||||
onSettled: async (_data, _error, { id }) => {
|
||||
await finalizeDeletedProformaCaches(queryClient, id);
|
||||
},
|
||||
|
||||
@ -5,7 +5,6 @@ import { type DeleteCustomerByIdParams, deleteCustomerById } from "../api";
|
||||
|
||||
import {
|
||||
type DeleteCustomerCacheContext,
|
||||
finalizeDeletedCustomerCaches,
|
||||
invalidateCustomerListQueries,
|
||||
prepareDeleteCustomerOptimisticUpdate,
|
||||
rollbackDeleteCustomerOptimisticUpdate,
|
||||
@ -37,9 +36,6 @@ export const useCustomerDeleteMutation = () => {
|
||||
rollbackDeleteCustomerOptimisticUpdate(queryClient, context);
|
||||
},
|
||||
|
||||
onSuccess: ({ id }) => {
|
||||
finalizeDeletedCustomerCaches(queryClient, id);
|
||||
},
|
||||
onSettled: async () => {
|
||||
await invalidateCustomerListQueries(queryClient);
|
||||
},
|
||||
|
||||
@ -6,7 +6,6 @@ import { type DeleteSupplierByIdParams, deleteSupplierById } from "../api";
|
||||
import { SUPPLIER_DELETE_KEY } from "./keys";
|
||||
import {
|
||||
type DeleteSupplierCacheContext,
|
||||
finalizeDeletedSupplierCaches,
|
||||
invalidateSupplierListQueries,
|
||||
prepareDeleteSupplierOptimisticUpdate,
|
||||
rollbackDeleteSupplierOptimisticUpdate,
|
||||
@ -38,10 +37,6 @@ export const useSupplierDeleteMutation = () => {
|
||||
rollbackDeleteSupplierOptimisticUpdate(queryClient, context);
|
||||
},
|
||||
|
||||
onSuccess: ({ id }) => {
|
||||
finalizeDeletedSupplierCaches(queryClient, id);
|
||||
},
|
||||
|
||||
onSettled: async () => {
|
||||
await invalidateSupplierListQueries(queryClient);
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user