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