22 lines
689 B
TypeScript
22 lines
689 B
TypeScript
|
|
import type { Metadata } from "next";
|
||
|
|
import { redirect } from "next/navigation";
|
||
|
|
|
||
|
|
import LoginForm from "@/components/LoginForm";
|
||
|
|
import { getSessionUser } from "@/lib/session";
|
||
|
|
|
||
|
|
export const dynamic = "force-dynamic";
|
||
|
|
|
||
|
|
export const metadata: Metadata = { title: "เข้าสู่ระบบ | Judge's Note" };
|
||
|
|
|
||
|
|
export default function LoginPage() {
|
||
|
|
// เข้าสู่ระบบอยู่แล้ว (cookie ครบ) → ไม่ต้องเห็นฟอร์มอีก
|
||
|
|
const user = getSessionUser();
|
||
|
|
if (user) redirect("/");
|
||
|
|
|
||
|
|
return (
|
||
|
|
<main className="flex min-h-dvh items-center justify-center px-4 py-10">
|
||
|
|
<LoginForm />
|
||
|
|
</main>
|
||
|
|
);
|
||
|
|
}
|