"use client"; import { useState } from "react"; import { useAuth } from "@/lib/auth"; import { useRouter } from "next/navigation"; import Link from "next/link"; export default function LoginPage() { const { login } = useAuth(); const router = useRouter(); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(""); const [loading, setLoading] = useState(false); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setError(""); setLoading(true); try { await login(email, password); router.push("/"); } catch (err: any) { setError(err.message || "登录失败"); } finally { setLoading(false); } }; return (
登录您的账户
没有账户?{" "} 注册