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