import { useState, type FormEvent } from 'react' import { Navigate } from 'react-router-dom' import { useAuth } from '@/lib/auth' import { authApi } from '@/api/auth' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' export function Login() { const { token, login } = useAuth() const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [error, setError] = useState('') const [loading, setLoading] = useState(false) if (token) return async function handleSubmit(e: FormEvent) { e.preventDefault() setError('') setLoading(true) try { const { token: t, user } = await authApi.login(email, password) login(t, user) } catch (err) { setError(err instanceof Error ? err.message : 'Erreur de connexion') } finally { setLoading(false) } } return (
{/* Motif de fond discret */}
{/* En-tête */}

FinancIAl

Votre journal financier augmenté par l'IA

{/* Carte formulaire */}
setEmail(e.target.value)} required autoComplete="email" placeholder="vous@exemple.com" />
setPassword(e.target.value)} required autoComplete="current-password" placeholder="••••••••" />
{error && (

{error}

)}

Pour obtenir un compte, contactez votre administrateur.

© {new Date().getFullYear()} FinancIAl — Accès restreint

) }