'use client'; import { Button } from '@nextui-org/react'; import { useCart } from 'components/cart/cart-context'; import CartItemView from 'components/cart/cart-item'; import { useCheckout } from 'components/checkout/checkout-provider'; import Price from 'components/price'; export default function CheckoutReview() { const { cart } = useCart(); const { checkout } = useCheckout(); const handleCreateOrder = async () => { try { const order = await fetch('/api/customer/order', { method: 'POST', body: JSON.stringify({ billing_address: checkout?.billing, shipping_address: checkout?.shipping, payment_method: checkout?.payment_method }) }); if (!order.ok) { const errorData = await order.json(); console.error('Error creating order:', errorData); throw new Error(errorData.error || 'Failed to create order'); } } catch (error) { console.error('Error creating order', error); } }; return (

Riassunto

{cart?.items.map((item, i) => (
  • ))} Totale
    Indirizzo di spedizione {checkout?.shipping?.first_name} {checkout?.shipping?.last_name} {checkout?.shipping?.address_1} {checkout?.shipping?.city} {checkout?.shipping?.state} {checkout?.shipping?.postcode} {checkout?.shipping?.country} Metodo di pagamento {checkout?.payment_method}
    ); }