import React, { useState } from 'react' import { useAuth } from './AuthContext' function LoginForm({ onSwitchToRegister }) { const { login, error } = useAuth() const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [loading, setLoading] = useState(false) const [localError, setLocalError] = useState('') const handleSubmit = async (e) => { e.preventDefault() setLocalError('') if (!email.trim()) { setLocalError('Введите email') return } if (!password) { setLocalError('Введите пароль') return } setLoading(true) const success = await login(email, password) setLoading(false) if (!success) { setLocalError(error || 'Ошибка входа') } } return (
Войдите в свой аккаунт
Нет аккаунта?{' '}