fix: If user.levels is empty then no level can be started
This commit is contained in:
parent
e398417c99
commit
5c1332da36
@ -44,7 +44,7 @@ const LevelListWithRouter = withRouter(
|
|||||||
|
|
||||||
toLevel(id: number) {
|
toLevel(id: number) {
|
||||||
const maxLevel = Math.max(...this.props.user.levels);
|
const maxLevel = Math.max(...this.props.user.levels);
|
||||||
if (maxLevel + 1 >= id) {
|
if ((maxLevel === -Infinity || maxLevel === +Infinity) || maxLevel + 1 >= id) {
|
||||||
this.props.history.push(`/level/${id}`);
|
this.props.history.push(`/level/${id}`);
|
||||||
} else {
|
} else {
|
||||||
this.props.setSnackbar(true);
|
this.props.setSnackbar(true);
|
||||||
|
Reference in New Issue
Block a user