19 lines
712 B
TypeScript
19 lines
712 B
TypeScript
import { redirect } from "next/navigation";
|
||
import { getCart } from "@/lib/api/cart";
|
||
import { requireSession } from "@/lib/auth/session";
|
||
import { getAddresses } from "@/lib/api/addresses";
|
||
import { CheckoutForm } from "@/components/customer/checkout-form";
|
||
|
||
export default async function CheckoutPage() {
|
||
await requireSession("/checkout");
|
||
const [cart, addresses] = await Promise.all([getCart(), getAddresses()]);
|
||
|
||
if (cart.groups.length === 0) redirect("/cart");
|
||
|
||
return (
|
||
<main className="mx-auto flex w-full max-w-2xl flex-1 flex-col gap-6 px-4 py-6">
|
||
<h1 className="text-lg font-bold">تکمیل سفارش</h1>
|
||
<CheckoutForm cart={cart} addresses={addresses} />
|
||
</main>
|
||
);
|
||
}
|