fix: product and inventory
This commit is contained in:
@@ -38,8 +38,23 @@ export const useProductRecipesMutation = () => {
|
||||
}
|
||||
})
|
||||
|
||||
const deleteProductRecipe = useMutation({
|
||||
mutationFn: async (id: string) => {
|
||||
const response = await api.delete(`/product-recipes/${id}`)
|
||||
return response.data
|
||||
},
|
||||
onSuccess: () => {
|
||||
toast.success('Product Recipe deleted successfully!')
|
||||
queryClient.invalidateQueries({ queryKey: ['product-recipes'] })
|
||||
},
|
||||
onError: (error: any) => {
|
||||
toast.error(error.response?.data?.errors?.[0]?.cause || 'Delete failed')
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
createProductRecipe,
|
||||
updateProductRecipe
|
||||
updateProductRecipe,
|
||||
deleteProductRecipe
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { Product, Products } from '../../types/services/product'
|
||||
import { api } from '../api'
|
||||
import { ProductRecipe } from '../../types/services/productRecipe'
|
||||
|
||||
interface ProductsQueryParams {
|
||||
export interface ProductsQueryParams {
|
||||
page?: number
|
||||
limit?: number
|
||||
search?: string
|
||||
// Add other filter parameters as needed
|
||||
category_id?: string
|
||||
is_active?: boolean
|
||||
is_active?: boolean | string
|
||||
}
|
||||
|
||||
export function useProducts(params: ProductsQueryParams = {}) {
|
||||
|
||||
Reference in New Issue
Block a user