import React, { useState } from 'react'; import Button from '@material-ui/core/Button'; import Typography from '@material-ui/core/Typography'; import Container from '@material-ui/core/Container'; import { connect } from 'react-redux'; import { bindActionCreators, Dispatch } from 'redux'; import {forgotPassword} from '../../reducers/auth/service'; import Grid from '@material-ui/core/Grid'; // @ts-ignore import styles from './Auth.module.scss'; import OutlinedInput from '@material-ui/core/OutlinedInput'; import { useTranslation } from "react-i18next"; const mapDispatchToProps = (dispatch: Dispatch): any => ({ forgotPassword: bindActionCreators(forgotPassword, dispatch) }); interface Props { classes: any; forgotPassword: typeof forgotPassword; } const ForgotPasswordComponent = (props: Props): any => { const { forgotPassword, classes } = props; const [state, setState] = useState({ email: '', isSubmitted: false }); const { t } = useTranslation(); const handleInput = (e: any): void => { e.preventDefault(); setState({ ...state, [e.target.name]: e.target.value }); }; const handleForgot = (e: any): void => { e.preventDefault(); forgotPassword(state.email); setState({ ...state, isSubmitted: true }); }; return (
{t('user:auth.forgotPassword.header')} {t('user:auth.forgotPassword.enterEmail')}
handleForgot(e)} > handleInput(e)} />
{state.isSubmitted ? (
{t('user:auth.forgotPassword.emailSent')}
) : ( '' )}
); }; const ForgotPasswordWrapper = (props: any): any => ; export const ForgotPassword = connect(null, mapDispatchToProps)(ForgotPasswordWrapper);