From f489b80de895e82de59fda0493da8eb2f5615f7a Mon Sep 17 00:00:00 2001 From: Kostya Date: Sun, 11 Feb 2024 23:18:45 +0300 Subject: [PATCH] fixed bug with saper --- .../src/pages/games-pages/SapergamePage.vue | 66 ++++++++++--------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/luckydiamond/src/pages/games-pages/SapergamePage.vue b/luckydiamond/src/pages/games-pages/SapergamePage.vue index 505ab14..a1d5f88 100644 --- a/luckydiamond/src/pages/games-pages/SapergamePage.vue +++ b/luckydiamond/src/pages/games-pages/SapergamePage.vue @@ -284,44 +284,46 @@ export default { } }, async amountCrystals(CrystalsCount) { - this.PercentageGameSteps = [] - if (![1, 5, 10, 24].includes(CrystalsCount)) { - this.clickedBtnCrystal = null - } - else { - let index - switch (CrystalsCount) { - case 1: - index = 0 - break - case 5: - index = 1 - break - case 10: - index = 2 - break - case 24: - index = 3 - break + setTimeout(async () => { + this.PercentageGameSteps = [] + if (![1, 5, 10, 24].includes(CrystalsCount)) { + this.clickedBtnCrystal = null + } + else { + let index + switch (CrystalsCount) { + case 1: + index = 0 + break + case 5: + index = 1 + break + case 10: + index = 2 + break + case 24: + index = 3 + break + } + this.clickedBtnCrystals(index, CrystalsCount) } - this.clickedBtnCrystals(index, CrystalsCount) - } - if (CrystalsCount >= 1 && CrystalsCount <= 24) { - try { + if (CrystalsCount >= 1 && CrystalsCount <= 24) { + try { await GetPercentageSteps(this.amountCrystals) - .then((response) => { - response.forEach((item) => { - if (item !== 'Infinity' && item !== '-Infinity') { - this.PercentageGameSteps.push(Number(item)) - } + .then((response) => { + response.forEach((item) => { + if (item !== 'Infinity' && item !== '-Infinity') { + this.PercentageGameSteps.push(Number(item)) + } + }) }) - }) - } - catch (e) { + } + catch (e) { console.error('Error in Percantage', e) + } } - } + }, 200) }, flippedCards: { async handler(value) {