import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; import { withTranslation } from 'react-i18next'; import { toastSuccess, toastError } from '../../util/apiNotification'; import { createSubscribedElement } from '../UnstatedUtils'; import AppContainer from '../../services/AppContainer'; import PersonalContainer from '../../services/PersonalContainer'; class BasicInfoSettings extends React.Component { constructor(appContainer) { super(); this.onClickSubmit = this.onClickSubmit.bind(this); } async componentDidMount() { try { await this.props.personalContainer.retrievePersonalData(); } catch (err) { toastError(err); } } async onClickSubmit() { const { t, personalContainer } = this.props; try { await personalContainer.updateBasicInfo(); toastSuccess(t('toaster.update_successed', { target: t('Basic Info') })); } catch (err) { toastError(err); } } render() { const { t, personalContainer } = this.props; const { registrationWhiteList } = personalContainer.state; return (
{ personalContainer.changeName(e.target.value) }} />
{ personalContainer.changeEmail(e.target.value) }} />
{registrationWhiteList.length !== 0 && (
{t('page_register.form_help.email')}
    {registrationWhiteList.map(data =>
  • {data}
  • )}
)}
{ personalContainer.changeIsEmailPublished(true) }} />
{ personalContainer.changeIsEmailPublished(false) }} />
{ personalContainer.changeLang('en-US') }} />
{ personalContainer.changeLang('ja') }} />
); } } const BasicInfoSettingsWrapper = (props) => { return createSubscribedElement(BasicInfoSettings, props, [AppContainer, PersonalContainer]); }; BasicInfoSettings.propTypes = { t: PropTypes.func.isRequired, // i18next appContainer: PropTypes.instanceOf(AppContainer).isRequired, personalContainer: PropTypes.instanceOf(PersonalContainer).isRequired, }; export default withTranslation()(BasicInfoSettingsWrapper);