'use client' import { useState } from 'react' import { AuthForm, AuthFormData } from '@/components/AuthForm' export default function ForgotPasswordPage() { const [isLoading, setIsLoading] = useState(false) const [error, setError] = useState() const [success, setSuccess] = useState(false) const handleSubmit = async (data: AuthFormData) => { setIsLoading(true) setError(undefined) try { const res = await fetch('/api/auth/forgot-password', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email: data.email }), }) const result = await res.json() if (!res.ok) { setError(result.error || 'Failed to send reset link') return } setSuccess(true) } catch { setError('Something went wrong. Please try again.') } finally { setIsLoading(false) } } if (success) { return (

Check your email

If an account exists with that email, we've sent a password reset link.

) } return (

Reset Password

Enter your email to receive a reset link

) }