summaryrefslogtreecommitdiff
path: root/app/client/auth/signup.component.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-09-17 00:46:06 +0200
committerJules Laplace <julescarbon@gmail.com>2018-09-17 00:46:06 +0200
commitd5d76a51cf79238c3177aa507213191d279d45ed (patch)
treee89bb1e6c39267b3eeccdab8d6d1d8a2dfd2b535 /app/client/auth/signup.component.js
parentd3e4bb3ed2585859a3adeb7eeff35b7c75ebd840 (diff)
signup works
Diffstat (limited to 'app/client/auth/signup.component.js')
-rw-r--r--app/client/auth/signup.component.js18
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>