import styles from "@/app/page.module.css";
import React from "react";
import LoginForm from "./LoginForm";
import { AuthState, getAuthState } from "@/auth/auth";
import { redirect } from "next/navigation";

export default async function Page() {
  const state = await getAuthState();

  if (state === AuthState.Registering) redirect("/register");
  if (state === AuthState.LoggedIn) redirect("/me");

  return (
    <main className={styles.main}>
      <LoginForm />
    </main>
  );
}
