mirror of
https://github.com/Paris-est-Ludique/intranet.git
synced 2025-06-09 09:04:20 +02:00
Fix forgot page email form
This commit is contained in:
parent
815b9c0406
commit
0f06aaea05
@ -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 type {} from "redux-thunk/extend-redux"
|
||||||
import { AppDispatch } from "../../store"
|
import { AppDispatch } from "../../store"
|
||||||
import { fetchVolunteerForgot } from "../../store/volunteerForgot"
|
import { fetchVolunteerForgot } from "../../store/volunteerForgot"
|
||||||
@ -12,13 +13,13 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ForgotForm = ({ dispatch, error, message }: Props): JSX.Element => {
|
const ForgotForm = ({ dispatch, error, message }: Props): JSX.Element => {
|
||||||
|
const emailRef = useRef<HTMLInputElement | null>(null)
|
||||||
|
|
||||||
const onSubmit = useCallback(
|
const onSubmit = useCallback(
|
||||||
(event: React.SyntheticEvent): boolean => {
|
(event: React.SyntheticEvent): boolean => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
const target = event.target as typeof event.target & {
|
event.stopPropagation()
|
||||||
email: { value: string }
|
const email = get(emailRef, "current.value", "")
|
||||||
}
|
|
||||||
const email = target.email.value
|
|
||||||
|
|
||||||
dispatch(fetchVolunteerForgot({ email }))
|
dispatch(fetchVolunteerForgot({ email }))
|
||||||
return false
|
return false
|
||||||
@ -33,7 +34,7 @@ const ForgotForm = ({ dispatch, error, message }: Props): JSX.Element => {
|
|||||||
</div>
|
</div>
|
||||||
<div className={styles.formLine} key="line-email">
|
<div className={styles.formLine} key="line-email">
|
||||||
<label htmlFor="email">Email</label>
|
<label htmlFor="email">Email</label>
|
||||||
<input type="email" id="email" name="utilisateur" />
|
<input type="email" id="email" name="utilisateur" ref={emailRef} />
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.formButtons}>
|
<div className={styles.formButtons}>
|
||||||
<FormSubmit onClick={onSubmit}>Envoyer</FormSubmit>
|
<FormSubmit onClick={onSubmit}>Envoyer</FormSubmit>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user