dispatch testing
This commit is contained in:
@@ -941,14 +941,9 @@ export function useFiestaCreateProductLocation() {
|
||||
return useMutation({
|
||||
mutationFn: (input: CreateProductLocationInput) => createProductLocation(input),
|
||||
onSuccess: (_, variables) => {
|
||||
// Invalidate the store catalogue so it fetches the new item (prefix match)
|
||||
qc.invalidateQueries({
|
||||
queryKey: ['fiesta', 'productLocations']
|
||||
});
|
||||
// Also invalidate productStocks so the Admin Catalogue UI updates
|
||||
qc.invalidateQueries({
|
||||
queryKey: ['fiesta', 'productStocks']
|
||||
});
|
||||
qc.invalidateQueries({ queryKey: ['catalogue', 'imported'] });
|
||||
qc.invalidateQueries({ queryKey: ['fiesta', 'productLocations'] });
|
||||
qc.invalidateQueries({ queryKey: ['fiesta', 'productStocks'] });
|
||||
},
|
||||
onError: (error: any) => {
|
||||
alert(`Error adding product: ${error.message}`);
|
||||
@@ -961,9 +956,9 @@ export function useFiestaDeleteProductLocation() {
|
||||
return useMutation({
|
||||
mutationFn: (input: DeleteProductLocationInput) => deleteProductLocation(input),
|
||||
onSuccess: (_, variables) => {
|
||||
qc.invalidateQueries({
|
||||
queryKey: ['fiesta', 'productLocations']
|
||||
});
|
||||
qc.invalidateQueries({ queryKey: ['catalogue', 'imported'] });
|
||||
qc.invalidateQueries({ queryKey: ['fiesta', 'productLocations'] });
|
||||
qc.invalidateQueries({ queryKey: ['fiesta', 'productStocks'] });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user