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

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