'use client'; import { useState } from 'react'; import { useRouter } from 'next/navigation'; import { authClient } from '@/lib/auth-client'; import Link from 'next/link'; export default function SignUpPage() { const router = useRouter(); const [name, setName] = useState(''); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); const handleSignUp = async (e: React.FormEvent) => { e.preventDefault(); setError(''); setLoading(true); try { const { error } = await authClient.signUp.email({ name, email, password, }); if (error) throw new Error(error.message); router.push('/dashboard'); router.refresh(); } catch (err: unknown) { setError(err instanceof Error ? err.message : 'Ошибка регистрации'); } finally { setLoading(false); } }; return (

Регистрация

{error && (
{error}
)}
setName(e.target.value)} required style={{ width: '100%', padding: 12, marginBottom: 12, border: '1px solid #ddd', borderRadius: 8, boxSizing: 'border-box', }} /> setEmail(e.target.value)} required style={{ width: '100%', padding: 12, marginBottom: 12, border: '1px solid #ddd', borderRadius: 8, boxSizing: 'border-box', }} /> setPassword(e.target.value)} required minLength={8} style={{ width: '100%', padding: 12, marginBottom: 16, border: '1px solid #ddd', borderRadius: 8, boxSizing: 'border-box', }} />

Уже есть аккаунт?{' '} Войти

); }