Refactor the handleGroupSizeInput method
This commit is contained in:
parent
3bb902b033
commit
2defc3df22
|
|
@ -163,14 +163,17 @@ class CreateTournamentForm extends React.Component {
|
||||||
|
|
||||||
handleGroupSizeInput(input) {
|
handleGroupSizeInput(input) {
|
||||||
const newSize = input.target.value;
|
const newSize = input.target.value;
|
||||||
if (newSize !== undefined && newSize > 2) {
|
|
||||||
if (newSize <= this.state.groupAdvance) {
|
if (newSize === undefined || newSize < 2) {
|
||||||
this.setState({
|
return;
|
||||||
groupSize: newSize, groupAdvance: newSize - 1
|
}
|
||||||
});
|
|
||||||
} else {
|
if (newSize <= this.state.groupAdvance) {
|
||||||
this.setState({groupSize: newSize});
|
this.setState({
|
||||||
}
|
groupSize: newSize, groupAdvance: newSize - 1
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.setState({groupSize: newSize});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue