"use client"; import { useState } from "react"; import { useAuth } from "@/lib/auth"; import { useRouter } from "next/navigation"; import Link from "next/link"; export default function RegisterPage() { const { register } = useAuth(); const router = useRouter(); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [inviteCode, setInviteCode] = useState(""); const [error, setError] = useState(""); const [loading, setLoading] = useState(false); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setError(""); if (password.length < 6) { setError("密码至少6位"); return; } setLoading(true); try { await register(email, password, inviteCode); router.push("/"); } catch (err: any) { setError(err.message || "注册失败"); } finally { setLoading(false); } }; return (

⚡ Arbitrage Engine

注册新账户(需要邀请码)

setInviteCode(e.target.value.toUpperCase())} 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 font-mono tracking-wider" placeholder="输入邀请码" required />
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="至少6位" required minLength={6} />
{error &&

{error}

}

已有账户?{" "} 登录

); }