"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 (

⚡ Arbitrage Engine

登录您的账户

setEmail(e.target.value)} className="w-full px-3 py-2 border border-slate-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent" placeholder="you@example.com" required />
setPassword(e.target.value)} className="w-full px-3 py-2 border border-slate-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent" placeholder="••••••••" required />
{error &&

{error}

}

没有账户?{" "} 注册

); }