import React from 'react'; import { withRouter } from 'react-router-dom'; class SignupForm extends React.Component { constructor(props) { super(props); this.state = this.props.userInfo; this.handleSubmit = this.handleSubmit.bind(this); this.demoUser = this.demoUser.bind(this); } renderErrors(errors) { const loginErrors = document.getElementById("signup-errors") while (loginErrors.firstChild) { loginErrors.firstChild.remove(); } loginErrors.appendChild(document.createTextNode(errors.errors.responseJSON)) } handleSubmit(e) { e.preventDefault(); this.props.signup(this.state).then( null, errors => this.renderErrors(errors) ); } handleChange(field) { return e => this.setState({[field]: e.target.value}) } demoUser(e) { e.preventDefault(); this.props.login({ email: "demo", password: "123123" }); } handleBirthday(field) { return e => this.setState({ birthday: Object.assign( {}, this.state.birthday, {[field]: Number(e.target.value)} ) }) } birthdayPicker() { let days = []; let months = []; let years = []; const monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; for (var day = 1; day <= 31; day++) { days.push(); } for (var month = 0; month < 12; month++) { months.push( ); } for (var year = 2018; year >= 1905; year--) { years.push(); } return (
); } render() { return (

Create a New Account

It's free and always will be.

Birthday
{ this.birthdayPicker() } Why do I need to provide my
birthday?

By clicking Sign Up, you agree to our Terms, Data Policy
and Cookies Policy. You may receive SMS Notifications from
us and can opt out any time.

) } } export default withRouter(SignupForm);