From bfaaf257323334168644e8a8ac915ecab30e4f2d Mon Sep 17 00:00:00 2001 From: cfngc4594 Date: Fri, 14 Mar 2025 14:38:51 +0800 Subject: [PATCH] feat(auth): add layout for authentication pages with redirect logic --- src/app/(auth)/layout.tsx | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/app/(auth)/layout.tsx diff --git a/src/app/(auth)/layout.tsx b/src/app/(auth)/layout.tsx new file mode 100644 index 0000000..8dae4d8 --- /dev/null +++ b/src/app/(auth)/layout.tsx @@ -0,0 +1,41 @@ +import Image from "next/image"; +import { auth } from "@/lib/auth"; +import { Code } from "lucide-react"; +import { redirect } from "next/navigation"; + +interface AuthLayoutProps { + children: React.ReactNode; +} + +export default async function AuthLayout({ + children +}: AuthLayoutProps) { + const session = await auth(); + if (session) redirect("/"); + + return ( +
+
+
+ +
+ +
+ Judge4c +
+
+
+
{children}
+
+
+
+ Image +
+
+ ); +}