diff --git a/luckydiamond/src/components/HeaderComponent.vue b/luckydiamond/src/components/HeaderComponent.vue index e45a4b2..50da6ce 100644 --- a/luckydiamond/src/components/HeaderComponent.vue +++ b/luckydiamond/src/components/HeaderComponent.vue @@ -25,6 +25,7 @@ export default { .then(response => { this.balance = response.currentMoney }) + eventBus.emit('Updatebalance-saper') } }, data() { diff --git a/luckydiamond/src/pages/games-pages/SapergamePage.vue b/luckydiamond/src/pages/games-pages/SapergamePage.vue index 9da9d00..2dc483c 100644 --- a/luckydiamond/src/pages/games-pages/SapergamePage.vue +++ b/luckydiamond/src/pages/games-pages/SapergamePage.vue @@ -373,6 +373,14 @@ export default { } } }, + mounted() { + eventBus.on('Updatebalance-saper', () => { + GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken")) + .then(response => { + this.balance = response + }) + }) + }, methods: { clickPlayButton() { this.v$.$touch() @@ -472,7 +480,12 @@ export default { if (content === 'max') { await GetCurrentMoney(GetCookie('AUTHTOKEN'), GetCookie('SearchToken')) .then((response) => { - this.amountDeposit = parseInt(response.currentMoney) + console.log(response.currentMoney, this.balance) + const responseBalance = response.currentMoney + + if (responseBalance === this.balance) { + this.amountDeposit = parseInt(responseBalance) + } }) } else {