"use client"; import { useState } from "react"; import { Navbar } from "@/components/layout/Navbar"; import { Footer } from "@/components/layout/Footer"; import { apiFetch } from "@/lib/api"; import { KeyRound } from "lucide-react"; export default function ForgotPasswordPage() { const [email, setEmail] = useState(""); const [status, setStatus] = useState(null); const [loading, setLoading] = useState(false); const submit = async (e: React.FormEvent) => { e.preventDefault(); if (!email) return; try { setLoading(true); setStatus(null); const res: any = await apiFetch("/api/users/forgot", { method: "POST", body: { email } }); setStatus(res?.message || "If that email exists, a password reset link has been sent."); } catch (err: any) { try { const parsed = JSON.parse(err?.message || ""); setStatus(parsed?.message || "Something went wrong"); } catch { setStatus(err?.message || "Something went wrong"); } } finally { setLoading(false); } }; return (

Forgot your password?

Enter your account email and we'll send you a link to reset your password.

setEmail(e.target.value)} required className="w-full border rounded px-3 py-2" />
{status &&

{status}

}
); }