import { useState } from 'react' import { useNavigate, Link as RouterLink } from 'react-router-dom' import { Card, Input, Button, Form, toast, TextField, Label, FieldError, } from '@heroui/react' import { buttonVariants } from '@heroui/styles' import { signUp } from '../../lib/auth-client' export default function RegisterPage() { const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [loading, setLoading] = useState(false) const navigate = useNavigate() const handleRegister = async (e: React.FormEvent) => { e.preventDefault() setLoading(true) try { await signUp.email( { email, password, name: email.split('@')[0], // Default name }, { onSuccess: () => { navigate('/') }, onError: (ctx) => { toast.danger(ctx.error.message) }, }, ) } catch (err) { console.error(err) } finally { setLoading(false) } } return (
注册 HLAE 中文站
或者
已有账号?登录
返回首页

已有账号?{' '} 去登录

) }