'use client'; import { useState } from 'react'; import { useRouter } from 'next/navigation'; import Link from 'next/link'; import { signUp } from '@/lib/auth-client'; export default function RegisterPage(): React.ReactElement { const router = useRouter(); const [error, setError] = useState(null); const [loading, setLoading] = useState(false); async function handleSubmit(e: React.FormEvent): Promise { e.preventDefault(); setError(null); setLoading(true); const form = new FormData(e.currentTarget); const name = form.get('name') as string; const email = form.get('email') as string; const password = form.get('password') as string; const result = await signUp.email({ name, email, password }); if (result.error) { setError(result.error.message ?? 'Registration failed'); setLoading(false); return; } router.push('/chat'); } return (

Create account

Get started with Mosaic

{error && (
{error}
)}

Already have an account?{' '} Sign in

); }