fix: product and inventory

This commit is contained in:
ferdiansyah783
2025-08-13 23:53:03 +07:00
parent ea6205cfa7
commit ba7911d04b
28 changed files with 435 additions and 204 deletions
+16 -1
View File
@@ -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
}
}
+2 -3
View File
@@ -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 = {}) {