import { NextResponse } from "next/server";
import { getCustomerOrders, getSessionCustomer } from "../../../lib/customerAuth";

export async function GET() {
  const session = await getSessionCustomer();
  if (!session) return NextResponse.json({ orders: [] }, { status: 401 });

  const orders = await getCustomerOrders(session.token, session.customer.id);
  return NextResponse.json({ orders });
}
