diff --git a/public/views/Index.vue.js b/public/views/Index.vue.js index 581f9c1..6d4796c 100644 --- a/public/views/Index.vue.js +++ b/public/views/Index.vue.js @@ -47,7 +47,7 @@ export default { - Start new game + @@ -80,6 +80,20 @@ export default { this.gamesFinished = json.gamesFinished this.images = json.images }, + computed: { + scoreModeInt () { + return parseInt(this.scoreMode, 10) + }, + tilesInt () { + return parseInt(this.tiles, 10) + }, + canStartNewGame () { + if (!this.tilesInt || !this.image || ![0, 1].includes(this.scoreModeInt)) { + return false + } + return true + }, + }, methods: { time(start, end) { const icon = end ? '🏁' : '⏳' @@ -99,9 +113,9 @@ export default { 'Content-Type': 'application/json' }, body: JSON.stringify({ - tiles: this.tiles, + tiles: this.tilesInt, image: this.image, - scoreMode: parseInt(this.scoreMode, 10), + scoreMode: this.scoreModeInt, }), }) if (res.status === 200) {