import { useState } from 'react' import type { FormEvent } from 'react' interface LoginPageProps { onLogin: (email: string, password: string) => Promise } export function LoginPage({ onLogin }: LoginPageProps) { const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [error, setError] = useState('') const [loading, setLoading] = useState(false) async function handleSubmit(e: FormEvent) { e.preventDefault() setError('') setLoading(true) try { await onLogin(email, password) } catch { setError('Invalid credentials') } finally { setLoading(false) } } return (

Research Workbench

{error &&
{error}
} setEmail(e.target.value)} autoFocus required /> setPassword(e.target.value)} required />
) }