import { cookies } from "next/headers";

import { LoginContainer, LoginSuccessContainer } from "@/components/core/login-form";

// Get the url before redirect to this page

export default async function Home() {
  const cookieStore = await cookies();
  const token = cookieStore.get("token");

  if (token) {
    return (
      <div className="flex justify-center items-center h-screen">
        <LoginSuccessContainer applicationName="SecNex" />
      </div>
    );
  }

  return (
    <div className="flex justify-center items-center h-screen">
      <LoginContainer applicationName="SecNex" />
    </div>
  );
}