import React from "react"; // react hook form import { useForm } from "react-hook-form"; // services import userService from "services/user.service"; // hooks // import useToast from "hooks/use-toast"; // ui import { Input } from "components/ui"; import { Button } from "@plane/ui"; // types type Props = { setIsResettingPassword: React.Dispatch>; }; export const EmailResetPasswordForm: React.FC = ({ setIsResettingPassword }) => { // const { setToastAlert } = useToast(); const { register, handleSubmit, formState: { errors, isSubmitting }, } = useForm({ defaultValues: { email: "", }, mode: "onChange", reValidateMode: "onChange", }); const forgotPassword = async (formData: any) => { const payload = { email: formData.email, }; // await userService // .forgotPassword(payload) // .then(() => // setToastAlert({ // type: "success", // title: "Success!", // message: "Password reset link has been sent to your email address.", // }) // ) // .catch((err) => { // if (err.status === 400) // setToastAlert({ // type: "error", // title: "Error!", // message: "Please check the Email ID entered.", // }); // else // setToastAlert({ // type: "error", // title: "Error!", // message: "Something went wrong. Please try again.", // }); // }); }; return (
/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test( value ) || "Email address is not valid", })} placeholder="Enter registered email address.." className="border-custom-border-300 h-[46px]" /> {errors.email &&
{errors.email.message}
}
); };