import React, { useState, useEffect } from 'react'; import { FormattedMessage, useIntl } from 'react-intl'; import { useHistory } from 'react-router-dom'; import Client, { ErrorInfo } from '../../classes/client'; import Header from '../layout/header'; import Footer from '../layout/footer'; import FormContainer from '../layout/form-container'; import { useSelector } from 'react-redux'; import { useMutation } from 'react-query'; import { activeInstance } from '../../redux/clientSlice'; import Input from '../form/input'; import GlobalError from '../form/global-error'; import SubmitButton from '../form/submit-button'; import Typography from '@material-ui/core/Typography'; const ForgotPassword = () => { const [email, setEmail] = useState(''); const [error, setError] = useState(); const history = useHistory(); const intl = useIntl(); const service: Client = useSelector(activeInstance); const mutation = useMutation( (email: string) => service.resetPassword(email), { onSuccess: () => history.push('/c/forgot-password-success'), onError: (error) => { setError(error); }, } ); const handleOnSubmit = (event: React.FormEvent) => { event.preventDefault(); mutation.mutate(email); }; return (
setEmail(e.target.value)} error={error} />
); }; const ForgotPasswordPage = (): React.ReactElement => { useEffect(() => { document.title = 'Reset Password | WiseMapping'; }); return (
); }; export { ForgotPasswordPage };