Code-block / Actions
export async function fetchOrders(customerId: string) { const params = new URLSearchParams({ customer: customerId, status: "paid", include: "items,shipping_address,payment", sort: "created_at:desc" }) const response = await fetch(`/api/orders?${params}`)
if (!response.ok) { throw new Error("Unable to load customer orders") }
return response.json()}