makearmy-app/app/auth/sign-up/page.tsx

23 lines
695 B
TypeScript
Raw Normal View History

2025-09-27 14:30:16 -04:00
// app/auth/sign-up/page.tsx
import { cookies } from "next/headers";
import { redirect } from "next/navigation";
import SignUp from "./sign-up";
import { isJwtValid } from "@/lib/jwt";
2025-09-27 14:30:16 -04:00
2025-09-30 22:14:50 -04:00
export default async function SignUpPage({
searchParams,
}: {
searchParams?: Record<string, string | string[] | undefined>;
}) {
const ck = await cookies();
const at = ck.get("ma_at")?.value;
if (isJwtValid(at)) redirect("/portal");
2025-09-30 22:14:50 -04:00
const sp = searchParams ?? {};
const nextParam = Array.isArray(sp.next) ? sp.next[0] : sp.next;
const nextPath =
nextParam && String(nextParam).startsWith("/") ? String(nextParam) : "/portal";
return <SignUp nextPath={nextPath} />;
2025-09-26 15:59:15 -04:00
}