editar, modificar, ver y crear productos listo
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
// import { EditInventory } from "../schemas/inventory";
|
||||
import { updateProductAction, createProductAction, } from "../actions/actions";
|
||||
import { updateProductAction, createProductAction,deleteProductAction } from "../actions/actions";
|
||||
|
||||
// Create mutation
|
||||
export function useCreateProduct() {
|
||||
@@ -25,11 +25,11 @@ export function useUpdateProduct() {
|
||||
}
|
||||
|
||||
// Delete mutation
|
||||
// export function useDeleteUser() {
|
||||
// const queryClient = useQueryClient();
|
||||
// return useMutation({
|
||||
// mutationFn: (id: number) => deleteUserAction(id),
|
||||
// onSuccess: () => queryClient.invalidateQueries({ queryKey: ['users'] }),
|
||||
// onError: (e) => console.error('Error:', e)
|
||||
// })
|
||||
// }
|
||||
export function useDeleteProduct() {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: (id: number) => deleteProductAction(id),
|
||||
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['product'] }),
|
||||
onError: (e) => console.error('Error:', e)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user