import { useState } from 'react'; import { forgotPassword } from '../../services/api'; import { Link } from 'react-router-dom'; export default function ForgotPassword() { const [email, setEmail] = useState(''); const [status, setStatus] = useState({ type: '', message: '' }); const [loading, setLoading] = useState(false); const handleSubmit = async (e) => { e.preventDefault(); setLoading(true); setStatus({ type: '', message: '' }); try { await forgotPassword(email); setStatus({ type: 'success', message: 'If an account exists with this email, you will receive password reset instructions.' }); setEmail(''); } catch (error) { setStatus({ type: 'error', message: 'Failed to process request. Please try again.' }); } finally { setLoading(false); } }; return (
Enter your email address and we'll send you instructions to reset your password.