added children to users

This commit is contained in:
Edin Dazdarevic
2015-03-19 14:27:04 +01:00
parent 1d16951fcf
commit 69f5faffe4
5 changed files with 55 additions and 4 deletions

View File

@@ -164,14 +164,27 @@ var Register = React.createClass({
},
register: function(e) {
if(this.validate()) {
var children = [];
if (this.state.myBabyDetailsVisible) {
children.push({
name: 'Dijete',
gender: 1
});
}
var user = new UserRegistration({
first_name: this.state.firstName,
last_name: this.state.lastName,
email: this.state.email,
password: this.state.password,
password_confirmation: this.state.passwordConfirmation
password_confirmation: this.state.passwordConfirmation,
children_attributes : children
});
// need to add info about child
UserActions.registerUser(user);
}
@@ -263,8 +276,8 @@ var Register = React.createClass({
<div className="col-md-4">
<button onClick={this.register} type="button" className="btn btn-default btn-lg">
Register2
</button>
Registruj me
</button>
</div>
</div>
</fieldset>