Make sanity check before sending create request to backend
This commit is contained in:
parent
5b64dc6c0e
commit
932cefff7b
|
|
@ -78,6 +78,7 @@ class CreateTournamentForm extends React.Component {
|
|||
this.increaseGroupSize = this.increaseGroupSize.bind(this);
|
||||
this.decreaseGroupSize = this.decreaseGroupSize.bind(this);
|
||||
this.generateTournamentCreationObject = this.generateTournamentCreationObject.bind(this);
|
||||
this.valuesAreCredible = this.valuesAreCredible.bind(this);
|
||||
|
||||
this.create = this.create.bind(this);
|
||||
}
|
||||
|
|
@ -197,11 +198,17 @@ class CreateTournamentForm extends React.Component {
|
|||
}
|
||||
|
||||
create() {
|
||||
createTournament(this.generateTournamentCreationObject(), () => {
|
||||
notify.show('Das Turnier wurde erfolgreich erstellt.', 'success', 5000);
|
||||
}, () => {
|
||||
notify.show('Das Turnier konnte nicht erstellt werden.', 'warning', 5000);
|
||||
});
|
||||
if (this.valuesAreCredible()) {
|
||||
createTournament(this.generateTournamentCreationObject(), () => {
|
||||
notify.show('Das Turnier wurde erfolgreich erstellt.', 'success', 5000);
|
||||
}, () => {
|
||||
notify.show('Das Turnier konnte nicht erstellt werden.', 'warning', 5000);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
valuesAreCredible() {
|
||||
return this.state.groups.length >= this.state.groupAdvance;
|
||||
}
|
||||
|
||||
generateTournamentCreationObject() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue