import { getPayment, getProfile } from "@/actions/payment"; import { authOptions } from "@/app/auth"; import CancelPaymentButton from "@/components/billing/cancel-payment-button"; import ClientErrorMessage from "@/components/client-error-message"; import DevicesToPay from "@/components/devices-to-pay"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; import { tryCatch } from "@/utils/tryCatch"; import { getServerSession } from "next-auth"; import { redirect } from "next/navigation"; export default async function PaymentPage({ params, }: { params: Promise<{ paymentId: string }>; }) { const session = await getServerSession(authOptions); const paymentId = (await params).paymentId; const [error, payment] = await tryCatch(getPayment({ id: paymentId })); if (error) { if (error.message === "Invalid token.") redirect("/auth/signin"); return ; } const [userError, userProfile] = await tryCatch(getProfile()); if (userError) { if (userError.message === "Invalid token.") redirect("/auth/signin"); return ; } return (

Payment

); }