"use client" import { useState } from "react" import Link from "next/link" import { Button } from "@/cosmic/elements/Button" import { Input } from "@/cosmic/elements/Input" import { Label } from "@/cosmic/elements/Label" import { Loader2 } from "lucide-react" interface ForgotPasswordFormProps { onSubmit: (formData: FormData) => Promise } export default function ForgotPasswordForm({ onSubmit, }: ForgotPasswordFormProps) { const [isLoading, setIsLoading] = useState(false) const [success, setSuccess] = useState(false) const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setIsLoading(true) try { const formData = new FormData(e.currentTarget) const result = await onSubmit(formData) if (result.error) { throw new Error(result.error) } setSuccess(true) } catch (err: any) { console.error(err.message || "An error occurred") } finally { setIsLoading(false) } } if (success) { return (

Check Your Email

If an account exists with that email address, we've sent instructions to reset your password.

Return to login
) } return (

Reset Password

Enter your email address and we'll send you instructions to reset your password.

Back to login
) }