import React from "react"; import { Button, Container, FormControl, FormErrorMessage, Heading, Input, Text } from "@chakra-ui/react"; import { SubmitHandler, useForm } from "react-hook-form"; import { LoginService } from "../client"; import useCustomToast from "../hooks/useCustomToast"; interface FormData { email: string; } const RecoverPassword: React.FC = () => { const { register, handleSubmit, formState: { errors, isSubmitting } } = useForm(); const showToast = useCustomToast(); const onSubmit: SubmitHandler = async (data) => { await LoginService.recoverPassword({ email: data.email, }); showToast("Email sent.", "We sent an email with a link to get back into your account.", "success"); }; return ( Password Recovery A password recovery email will be sent to the registered account. {errors.email && {errors.email.message}} ); }; export default RecoverPassword;