import React, {FormEvent, SyntheticEvent, useState} from "react" import Field from "../../components/Field"; import axios from "axios"; import {useNavigate} from "react-router-dom"; import useAuthUser from "../../hooks/AuthUser"; import useAxiosTools from "../../hooks/AxiosTools"; const ForgotPassword = () => { const [email, setEmail] = useState('') const [message, setMessage] = useState(false) const {errorCatch, errorLabel, cleanErrors, axiosGet, axiosPost} = useAxiosTools() const handleSubmit = async (event: FormEvent) => { event.preventDefault() try { cleanErrors() await axiosGet('/sanctum/csrf-cookie') const res = await axiosPost('/api/forgot', {email}) setMessage(true) } catch (e) { errorCatch(e) } } return

Mot de passe oublié

{message &&

Un email vous a été envoyé pour modifier le mot de passe.

} {errorLabel()} setEmail(event.target.value)} autoFocus>Email
} export default ForgotPassword