"use client"; import { useState } from "react"; import { AuthCard, AuthFooterLink } from "@/components/auth/auth-card"; import { auth, AuthError } from "@/lib/auth"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; export default function ForgotPasswordPage() { const [email, setEmail] = useState(""); const [submitted, setSubmitted] = useState(false); const [error, setError] = useState(null); const [submitting, setSubmitting] = useState(false); async function onSubmit(e: React.SyntheticEvent) { e.preventDefault(); setError(null); setSubmitting(true); try { await auth.forgotPassword(email); setSubmitted(true); } catch (err) { setError(err instanceof AuthError ? err.message : "Something went wrong."); } finally { setSubmitting(false); } } if (submitted) { return ( } >

Didn't get an email? Check your spam folder or try again in a minute.

); } return ( } >
setEmail(e.target.value)} />

{error ?

{error}

: null}
); }