import { useState } from 'react'; import { useForgotPassword } from '@imphnen-frontend-service/service'; import { Link, useNavigate } from 'react-router'; import { toast } from 'sonner'; import { Icon } from '@iconify/react'; import ThemeToggle from '../../../components/theme-toggle'; export default function ForgotPasswordPage() { const [email, setEmail] = useState(''); const [emailSent, setEmailSent] = useState(false); const navigate = useNavigate(); const forgotPasswordMutation = useForgotPassword(); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); if (!email) { toast.error('Please enter your email'); return; } try { await forgotPasswordMutation.mutateAsync({ email }); setEmailSent(true); toast.success('Password reset email sent! Check your inbox.'); } catch (err) { toast.error((err as Error).message || 'Failed to send reset email'); } }; if (emailSent) { return (
We've sent a password reset link to {email}
Click the link in the email to reset your password. The link will expire in 1 hour.
No worries, we'll send you reset instructions