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

export function useCreatePurchaseRequest() {
  const queryClient = useQueryClient()

  return useMutation({
    mutationFn: createPurchaseRequest,
    onSuccess: () => {
      queryClient.invalidateQueries({ queryKey: ['b2b', 'purchase-requests'] })
    },
  })
}
