diff options
Diffstat (limited to 'app/client/auth/signup.component.js')
| -rw-r--r-- | app/client/auth/signup.component.js | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/app/client/auth/signup.component.js b/app/client/auth/signup.component.js index c86d31b..e54084b 100644 --- a/app/client/auth/signup.component.js +++ b/app/client/auth/signup.component.js @@ -2,7 +2,7 @@ import { h, Component } from 'preact'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { Redirect } from 'react-router-dom'; -import actions from './auth.actions'; +import * as actions from './auth.actions'; import { Group, Param, TextInput, Button } from '../common'; @@ -17,12 +17,9 @@ class Signup extends Component { this.handleChange = this.handleChange.bind(this) this.handleSubmit = this.handleSubmit.bind(this) } - handleChange(e) { - const name = e.target.name - const value = e.target.value + handleChange(value, name) { this.setState({ [name]: value, - error: null, }) } validate(){ @@ -36,7 +33,8 @@ class Signup extends Component { if (!this.validate) { return this.props.actions.setError('bad password') } - this.props.actions.signup(this.state) + let { ...user } = this.state + this.props.actions.signup(user) } render(){ if (this.props.auth.isAuthenticated) { @@ -54,26 +52,26 @@ class Signup extends Component { name="username" type="text" value={this.state.username} - onChange={this.handleChange} + onInput={this.handleChange} /> <TextInput title="Password" name="password" type="password" value={this.state.password} - onChange={this.handleChange} + onInput={this.handleChange} /> <TextInput title="Password again :)" name="password2" type="password" value={this.state.password2} - onChange={this.handleChange} + onInput={this.handleChange} /> <Button loading={this.props.auth.loading} > - Login + Sign up </Button> {this.renderAuthError()} </Group> |
