diff -r f0f83f5530a6 -r c78d579f4b55 client/src/components/Register.js --- a/client/src/components/Register.js Thu Dec 06 01:35:30 2018 +0100 +++ b/client/src/components/Register.js Tue Dec 18 02:27:22 2018 +0100 @@ -2,18 +2,40 @@ import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import * as authActions from '../actions/authActions'; +import { Trans } from 'react-i18next'; +import * as R from 'ramda'; class Register extends Component { + constructor(props) { + super(props); + + this.state = { + username: '', + email: '', + password1: '', + password2: '' + } + + + } + register = () => { - const username = this.username.value; - const email = this.email.value; - const password1 = this.password1.value; - const password2 = this.password2.value; + const { + username, + email, + password1, + password2 } = this.state; this.props.authActions.registerSubmit(username, email, password1, password2); } + handleChange = (event) => { + const newState = {}; + newState[event.target.name] = event.target.value; + this.setState(newState); + } + submit = (e) => { e.preventDefault(); @@ -26,16 +48,44 @@ } renderErrorMessage(errorMessages, fieldname) { - if (errorMessages && errorMessages.has(fieldname)) { - return errorMessages.get(fieldname).map((message, key) => -
{ message }
+ if (errorMessages && fieldname in errorMessages) { + return errorMessages[fieldname].map((message, key) => +{ message }
); } } + renderNonFieldErrors(errorMessages) { + + if (errorMessages && errorMessages.error) { + return ( +
- Déjà inscrit ? Se connecter.
+