import { getIsAdmin } from "@/lib/auth";
import { redirect } from "@/i18n/navigation";
import { getLocale } from "next-intl/server";
import { AdminLoginForm } from "./AdminLoginForm";

export default async function AdminLoginPage() {
  const locale = await getLocale();
  if (await getIsAdmin()) {
    redirect({ href: "/admin", locale });
  }
  return <AdminLoginForm />;
}
