import React from 'react'; import PropTypes from 'prop-types'; import i18next from 'i18next'; import { withTranslation } from 'react-i18next'; import { localeMetadatas } from '../util/i18n'; class InstallerForm extends React.Component { constructor(props) { super(props); this.state = { isValidUserName: true, selectedLang: {}, }; // this.checkUserName = this.checkUserName.bind(this); } componentWillMount() { this.changeLanguage(localeMetadatas[0]); } // checkUserName(event) { // const axios = require('axios').create({ // headers: { // 'Content-Type': 'application/json', // 'X-Requested-With': 'XMLHttpRequest', // }, // responseType: 'json', // }); // axios.get('/_api/check_username', { params: { username: event.target.value } }) // .then((res) => { return this.setState({ isValidUserName: res.data.valid }) }); // } changeLanguage(meta) { i18next.changeLanguage(meta.id); this.setState({ selectedLang: meta }); } render() { const hasErrorClass = this.state.isValidUserName ? '' : ' has-error'; const unavailableUserId = this.state.isValidUserName ? '' : { this.props.t('installer.unavaliable_user_id') }; return (
{ this.props.t('installer.create_initial_account') }
{ this.props.t('installer.initial_account_will_be_administrator_automatically') }