import { useState } from 'react' import Button from '@material-ui/core/Button' import TextField from '@material-ui/core/TextField' 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 '../../../redux/auth/service' import Grid from '@material-ui/core/Grid' import './style.scss' const mapDispatchToProps = (dispatch: Dispatch) => ({ forgotPassword: bindActionCreators(forgotPassword, dispatch) }) interface Props { classes: any, forgotPassword: typeof forgotPassword } const ForgotPassword = (props: Props) => { const { forgotPassword, classes } = props const [state, setState] = useState({ email: '', isSubmitted: false }) const handleInput = (e: any) => { e.preventDefault() setState({ ...state, [e.target.name]: e.target.value }) } const handleForgot = (e: any) => { e.preventDefault() forgotPassword(state.email) setState({ ...state, isSubmitted: true }) } return (
Forgot Password Please enter your registered email address and we'll send you a password reset link.
handleForgot(e)} > handleInput(e)} />
{state.isSubmitted ? (
Reset Password Email was sent. Please check your email.
) : ( '' )}
) } const ForgotPasswordWrapper = (props) => export default connect(mapDispatchToProps)(ForgotPasswordWrapper)