'use client'; import { signUp } from '@/lib/better-auth'; import { useState } from 'react'; export default function SignUp() { const [name, setName] = useState(''); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [loading, setLoading] = useState(false); const [error, setError] = useState(''); const handleSignUp = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setError(''); try { const result = await signUp.email({ email, password, name, }); if (result.error) { setError(result.error.message || 'Sign up failed'); } else { window.location.href = '/'; } } catch (err) { setError('Sign up failed'); } finally { setLoading(false); } }; return (