import { useState, type FormEvent } from 'react'; import { useAuth } from '../context/AuthContext'; export function LoginPage() { const { login, error } = useAuth(); const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); const [submitting, setSubmitting] = useState(false); const handleSubmit = async (e: FormEvent) => { e.preventDefault(); setSubmitting(true); try { await login(username, password); } catch { // error state managed by AuthContext } finally { setSubmitting(false); } }; return (
Войдите для продолжения