import { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Helmet } from 'react-helmet-async'; import { Mail } from 'lucide-react'; import { toast } from 'sonner'; import { getApiClient } from '../services/api'; const api = getApiClient(); export default function ForgotPasswordPage() { const { t } = useTranslation(); const [email, setEmail] = useState(''); const [submitted, setSubmitted] = useState(false); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setError(null); setLoading(true); try { await api.post('/auth/forgot-password', { email }); setSubmitted(true); toast.success(t('auth.forgotPassword.sent')); } catch { const errMsg = t('auth.forgotPassword.error'); setError(errMsg); toast.error(errMsg); } finally { setLoading(false); } }; return ( <> {t('auth.forgotPassword.title')} — {t('common.appName')}

{t('auth.forgotPassword.title')}

{t('auth.forgotPassword.subtitle')}

{submitted ? (

{t('auth.forgotPassword.sent')}

) : (
setEmail(e.target.value)} placeholder={t('account.emailPlaceholder')} className="w-full rounded-lg border border-slate-300 px-3 py-2 text-sm dark:border-slate-600 dark:bg-slate-700 dark:text-slate-200" />
{error && (

{error}

)}
)}
); }