import { useState } from 'react' import { Link, useNavigate } from 'react-router-dom' import { useAuth } from '@/context/AuthContext' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Mail, Lock, ArrowRight, AlertCircle } from 'lucide-react' export function Login() { const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [error, setError] = useState('') const [loading, setLoading] = useState(false) const { login } = useAuth() const navigate = useNavigate() const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setError('') setLoading(true) try { await login(email, password) navigate('/dashboard') } catch (err: unknown) { setError(err instanceof Error ? err.message : 'Login failed. Please check your credentials.') } finally { setLoading(false) } } return (
MailFlow
Sign in to access your dashboard.
{/* Error message */} {error && ({error}
Don't have an account?{' '} Sign up free
Thousands of users already trust MailFlow for more productive email communication.