"use client" import { useState } from "react" import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Mail, ArrowLeft, CheckCircle } from "lucide-react" import Link from "next/link" import { getApiUrl } from "@/lib/api-config" export default function ForgotPasswordPage() { const [email, setEmail] = useState("") const [loading, setLoading] = useState(false) const [submitted, setSubmitted] = useState(false) const [error, setError] = useState("") const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setLoading(true) setError("") try { const res = await fetch(`${getApiUrl()}/auth/forgot-password`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ email }) }) if (res.ok) { setSubmitted(true) } else { const data = await res.json() setError(data.detail || "Failed to send reset email") } } catch (e) { setError("An error occurred. Please try again.") } finally { setLoading(false) } } if (submitted) { return (
Check Your Email If an account exists with that email, we've sent password reset instructions.
) } return (
Forgot Password? Enter your email and we'll send you a reset link.
setEmail(e.target.value)} required />
{error && (

{error}

)}
Back to Login
) }