import { LoginForm } from "@/components/login-form"; import { signIn } from "@/lib/auth"; import { GalleryVerticalEndIcon } from "lucide-react"; import { AuthError } from "next-auth"; import { redirect } from "next/navigation"; async function authenticate(formData: FormData) { "use server"; try { await signIn("credentials", { email: formData.get("email"), password: formData.get("password"), redirectTo: "/admin/dashboard", }); } catch (error) { if (error instanceof AuthError) { redirect("/admin/login?error=CredentialsSignin"); } throw error; } } export default async function LoginPage({ searchParams, }: { searchParams?: Promise<{ error?: string }>; }) { const params = await searchParams; const error = params?.error === "CredentialsSignin" ? "账号或密码错误,请重试。" : undefined; return (
Wallora Admin
); }