import React, { PropTypes } from 'react' import { Link } from 'react-router' import linkState from '../helpers/linkState' import openExternal from '../helpers/openExternal' var Hq = require('../Services/Hq') export default class SignupContainer extends React.Component { constructor (props) { super(props) this.state = { user: {}, connectionFailed: false, emailConflicted: false, nameConflicted: false, validationFailed: false, isSending: false, error: null } this.linkState = linkState this.openExternal = openExternal } handleSubmit (e) { this.setState({ isSending: true, error: null }, function () { Hq.signup(this.state.user) .then(res => { localStorage.setItem('token', res.body.token) localStorage.setItem('currentUser', JSON.stringify(res.body.user)) this.props.history.pushState('userHome', {userId: res.body.user.id}) }) .catch(function (err) { console.error(err) if (err.response == null) { return this.setState({ error: {name: 'CunnectionRefused', message: 'Can\'t connect to API server.'}, isSending: false }) } // Connection Failed or Whatever this.setState({ error: err.response.body, isSending: false }) }.bind(this)) }) e.preventDefault() } render () { return (
会員登録することで、当サイトの利用規約及びCookieの使用を含むデータに関するポリシーに同意するものとします。