import { BlitzPage, useRouterQuery, Link, useMutation, Routes } 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 { ResetPassword } from "../validations"; import resetPassword from "../../auth/mutations/reset-password"; const ResetPasswordPage: BlitzPage = () => { const query = useRouterQuery(); const [resetPasswordMutation, { isSuccess }] = useMutation(resetPassword); return (

Set a New Password

{isSuccess ? (

Password Reset Successfully

Go to the homepage

) : (
{ try { await resetPasswordMutation(values); } catch (error) { if (error.name === "ResetPasswordError") { return { [FORM_ERROR]: error.message, }; } else { return { [FORM_ERROR]: "Sorry, we had an unexpected error. Please try again.", }; } } }} > )}
); }; ResetPasswordPage.redirectAuthenticatedTo = "/"; ResetPasswordPage.getLayout = (page) => {page}; export default ResetPasswordPage;