import { useMutation } from '@tanstack/react-query'
import { createOrder } from '../api/paymentApi'

export function useCreateOrder() {
  return useMutation({
    mutationFn: createOrder,
    onSuccess: (data) => {
      const url = data.order.itpay_payment_qr_url_desktop
      if (url) window.location.href = url
    },
  })
}
