import type { BlitzPage } from "blitz"; import { Routes, useMutation } from "blitz"; import BaseLayout from "../../core/layouts/base-layout"; import { LabeledTextField } from "../../core/components/labeled-text-field"; import { Form, FORM_ERROR } from "../../core/components/form"; import { ForgotPassword } from "../validations"; import forgotPassword from "../../auth/mutations/forgot-password"; const ForgotPasswordPage: BlitzPage = () => { const [forgotPasswordMutation, { isSuccess }] = useMutation(forgotPassword); return (

Forgot your password?

{isSuccess ? (

Request Submitted

If your email is in our system, you will receive instructions to reset your password shortly.

) : (
{ try { await forgotPasswordMutation(values); } catch (error: any) { return { [FORM_ERROR]: "Sorry, we had an unexpected error. Please try again.", }; } }} > )}
); }; ForgotPasswordPage.redirectAuthenticatedTo = Routes.Messages(); ForgotPasswordPage.getLayout = (page) => {page}; export default ForgotPasswordPage;