Correctly format the sent data

This commit is contained in:
JP1998 2019-04-11 15:35:37 +02:00
parent 4964040ad8
commit 9525aa68d5
1 changed files with 11 additions and 1 deletions

View File

@ -179,11 +179,21 @@ class CreateTournamentForm extends React.Component {
'name': this.state.name,
'description': this.state.description,
'public': this.state.public,
'teams': this.state.teams
'teams': this.createTeamArray(this.state.teams)
}, () => {
notify.show('Das Turnier wurde erfolgreich erstellt.', 'success', 5000);
}, () => {
notify.show('Das Turnier konnte nicht erstellt werden.', 'warning', 5000);
});
}
createTeamArray(teamnames) {
var result = [];
for(var i = 0; i < teamnames.length; i++) {
result[i] = { 'name': teamnames[i] };
}
return result;
}
}