import React from 'react' import { connect } from 'react-redux' import PropTypes from 'prop-types' import { translate } from 'react-i18next' import {newFlashMessage} from '../../action-creator.sync.js' require('./PersonalData.styl') export class PersonalData extends React.Component { constructor (props) { super(props) this.state = { newName: '', newEmail: '', checkPassword: '' } } handleChangeName = e => this.setState({newName: e.target.value}) handleChangeEmail = e => this.setState({newEmail: e.target.value}) handleChangeCheckPassword = e => this.setState({checkPassword: e.target.value}) handleClickSubmit = () => { const { props, state } = this if (state.newEmail !== '' && state.checkPassword === '') { props.dispatch(newFlashMessage(props.t('Please type your password in order to change your email. (For security reasons)'), 'info')) return } props.onClickSubmit(state.newName, state.newEmail, state.checkPassword) } render () { const { props } = this return (
{props.t('Account information')}
{props.t('Name:')}
{props.t('Email Address:')}
) } } PersonalData.propTypes = { onClickSubmit: PropTypes.func } const mapStateToProps = () => ({}) export default connect(mapStateToProps)(translate()(PersonalData))