Rename component interfaces

This commit is contained in:
Ephraim Atta-Duncan
2023-06-07 10:10:56 +00:00
parent 79bd410687
commit 7184c47ac4
2 changed files with 6 additions and 6 deletions

View File

@ -6,17 +6,17 @@ import { ArrowLeftIcon } from "@heroicons/react/24/outline";
import { FormProvider, useForm } from "react-hook-form"; import { FormProvider, useForm } from "react-hook-form";
import { toast } from "react-hot-toast"; import { toast } from "react-hot-toast";
interface IForgotPassword { interface ForgotPasswordForm {
email: string; email: string;
} }
export default function ForgotPassword() { export default function ForgotPassword() {
const methods = useForm<IForgotPassword>(); const methods = useForm<ForgotPasswordForm>();
const { register, formState, resetField } = methods; const { register, formState, resetField } = methods;
const [resetSuccessful, setResetSuccessful] = useState(false); const [resetSuccessful, setResetSuccessful] = useState(false);
const onSubmit = async (values: IForgotPassword) => { const onSubmit = async (values: ForgotPasswordForm) => {
const response = await toast.promise( const response = await toast.promise(
fetch(`/api/auth/forgot-password`, { fetch(`/api/auth/forgot-password`, {
method: "POST", method: "POST",

View File

@ -7,7 +7,7 @@ import { ArrowLeftIcon } from "@heroicons/react/24/outline";
import { FormProvider, useForm } from "react-hook-form"; import { FormProvider, useForm } from "react-hook-form";
import { toast } from "react-hot-toast"; import { toast } from "react-hot-toast";
interface IResetPassword { interface ForgotPasswordForm {
password: string; password: string;
confirmPassword: string; confirmPassword: string;
} }
@ -16,13 +16,13 @@ export default function ResetPassword(props: any) {
const router = useRouter(); const router = useRouter();
const { token } = router.query; const { token } = router.query;
const methods = useForm<IResetPassword>(); const methods = useForm<ForgotPasswordForm>();
const { register, formState, watch } = methods; const { register, formState, watch } = methods;
const password = watch("password", ""); const password = watch("password", "");
const [resetSuccessful, setResetSuccessful] = useState(false); const [resetSuccessful, setResetSuccessful] = useState(false);
const onSubmit = async (values: IResetPassword) => { const onSubmit = async (values: ForgotPasswordForm) => {
const response = await toast.promise( const response = await toast.promise(
fetch(`/api/auth/reset-password`, { fetch(`/api/auth/reset-password`, {
method: "POST", method: "POST",