import { useMutation, useQueryClient } from '@tanstack/react-query'
import { deactivateProduct } from '../api/deactivateProduct'

export function useDeactivateProduct() {
  const queryClient = useQueryClient()
  return useMutation({
    mutationFn: (id: number) => deactivateProduct(id),
    onSuccess: () => {
      queryClient.invalidateQueries({ queryKey: ['products'] })
    },
  })
}
