import React, { 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'; // @ts-ignore import styles from './Auth.module.scss'; import { EmptyLayout } from '../../../common/components/Layout/EmptyLayout'; import { resetPassword } from '../../reducers/auth/service'; import { useTranslation } from "react-i18next"; interface Props { completeAction?: any, resetPassword: typeof resetPassword; token: string; } export default (props: Props): any => { const { resetPassword, token } = props; const initialState = { password: '' }; const [state, setState] = useState(initialState); const { t } = useTranslation(); const handleInput = (e: any): void => { e.preventDefault(); setState({ ...state, [e.target.name]: e.target.value }); }; const handleReset = (e: any): void => { e.preventDefault(); resetPassword(token, state.password); if(props.completeAction) props.completeAction(); }; return (
{t('user:auth.resetPassword.header')} {t('user:auth.resetPassword.description')}
handleReset(e)}> handleInput(e)} />
); };