import { useState } from 'react'; import { Button } from '../ui/button'; import { Card, CardContent } from '../ui/card'; import { Input } from '../ui/input'; import { Label } from '../ui/label'; import { signUp } from '../../lib/auth-client'; const logo = '/logo.png'; interface Props { onLogin: () => void; onVerify: () => void; } export function SignUpForm({ onLogin, onVerify }: Props) { const [name, setName] = useState(''); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [confirm, setConfirm] = useState(''); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); setError(''); if (password.length < 8) { setError('Password must be at least 8 characters'); return; } if (password !== confirm) { setError('Passwords do not match'); return; } setLoading(true); const res = await signUp.email({ name, email, password, callbackURL: window.location.origin, }); setLoading(false); if (res.error) { setError(res.error.message || 'Failed to create account'); } else { onVerify(); } } return (
LabWise

Create your LabWise account.

setName(e.target.value)} required autoComplete="name" />
setEmail(e.target.value)} required autoComplete="email" />
setPassword(e.target.value)} required autoComplete="new-password" placeholder="Min. 8 characters" />
setConfirm(e.target.value)} required autoComplete="new-password" />
{error &&

{error}

}

Already have an account?{' '}

); }