Files
MIS-Contro-Tower/app/login/page.tsx
2026-04-22 05:04:19 +00:00

24 lines
616 B
TypeScript

import { cookies } from "next/headers";
import { redirect } from "next/navigation";
import LoginForm from "./LoginForm"; // adjust path if needed
export default async function LoginPage({
searchParams,
}: {
searchParams?: Promise<{ next?: string }>;
}) {
const session = (await cookies()).get("mis_session")?.value;
// If already logged in, send to next or machines
if (session) {
const params = searchParams ? await searchParams : {};
const next = params?.next || "/machines";
redirect(next);
}
// ...your existing login UI below
return <LoginForm />; // ✅ actually render it
}