diff --git a/src/components/ForgotForm/ForgotForm.tsx b/src/components/ForgotForm/ForgotForm.tsx index ad91c70..491d736 100644 --- a/src/components/ForgotForm/ForgotForm.tsx +++ b/src/components/ForgotForm/ForgotForm.tsx @@ -1,4 +1,5 @@ -import React, { memo, useCallback } from "react" +import React, { memo, useCallback, useRef } from "react" +import { get } from "lodash" import type {} from "redux-thunk/extend-redux" import { AppDispatch } from "../../store" import { fetchVolunteerForgot } from "../../store/volunteerForgot" @@ -12,13 +13,13 @@ interface Props { } const ForgotForm = ({ dispatch, error, message }: Props): JSX.Element => { + const emailRef = useRef(null) + const onSubmit = useCallback( (event: React.SyntheticEvent): boolean => { event.preventDefault() - const target = event.target as typeof event.target & { - email: { value: string } - } - const email = target.email.value + event.stopPropagation() + const email = get(emailRef, "current.value", "") dispatch(fetchVolunteerForgot({ email })) return false @@ -33,7 +34,7 @@ const ForgotForm = ({ dispatch, error, message }: Props): JSX.Element => {
- +
Envoyer