"use client" import { Button } from "@/components/ui/button" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { ArrowLeft, CheckCircle2 } from "lucide-react" import Link from "next/link" import { useState } from "react" import { Logo } from "@/components/Logo" export default function ForgotPasswordPage() { const [email, setEmail] = useState("") const [error, setError] = useState("") const [isSubmitted, setIsSubmitted] = useState(false) const [loading, setLoading] = useState(false) const handleReset = async (e: React.FormEvent) => { e.preventDefault() setError("") setLoading(true) try { // Calling the backend proxy endpoint const res = await fetch("/api/auth/forgot-password", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ email }) }) const data = await res.json() if (data.success) { setIsSubmitted(true) } else { setError(data.error || "Failed to process request.") } } catch (err) { setError("An error occurred. Please try again.") } finally { setLoading(false) } } return (
We've sent password reset instructions to {email}.