import React, { useState } from 'react'; import { FiMail, FiLock } from 'react-icons/fi'; import { authAPI } from '../services/api'; const Login = ({ onLogin }) => { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(''); const [busy, setBusy] = useState(false); const submit = async (e) => { e.preventDefault(); setBusy(true); setError(''); try { const me = await authAPI.login(email.trim().toLowerCase(), password); onLogin(me); } catch (err) { setError(err.message); } finally { setBusy(false); } }; return (

MailAdmin

Sign in to manage your mail server

setEmail(e.target.value)} className="input-field pl-10" required autoFocus />
setPassword(e.target.value)} className="input-field pl-10" required />
{error &&

{error}

}
); }; export default Login;