mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-10 12:19:31 +02:00
added dinamic-update for balance
This commit is contained in:
@@ -4,6 +4,9 @@ import "@/assets/css/ComponentsStyles/header.css";
|
|||||||
// import { GetAuthCodeFromCurrentPath } from '@/assets/js/authentication/LoggingMiddleware.js';
|
// import { GetAuthCodeFromCurrentPath } from '@/assets/js/authentication/LoggingMiddleware.js';
|
||||||
import { LogIn } from "@/assets/js/authentication/AuthService.js";
|
import { LogIn } from "@/assets/js/authentication/AuthService.js";
|
||||||
import { GetCurrentMoney } from "@/assets/js/rest/RestMethods.js";
|
import { GetCurrentMoney } from "@/assets/js/rest/RestMethods.js";
|
||||||
|
|
||||||
|
import {eventBus} from "@/main";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
SetCookie,
|
SetCookie,
|
||||||
GetCookie,
|
GetCookie,
|
||||||
@@ -18,6 +21,12 @@ export default {
|
|||||||
this.balance = 0;
|
this.balance = 0;
|
||||||
DeleteAllCookie();
|
DeleteAllCookie();
|
||||||
},
|
},
|
||||||
|
updateBalanceMethod() {
|
||||||
|
GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken"))
|
||||||
|
.then(response => {
|
||||||
|
this.balance = response.currentMoney
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -27,6 +36,11 @@ export default {
|
|||||||
userName: "",
|
userName: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
eventBus.on('Updatebalance', () => {
|
||||||
|
this.updateBalanceMethod()
|
||||||
|
})
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
try {
|
try {
|
||||||
let authCode = this.$route.query.code;
|
let authCode = this.$route.query.code;
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ import { GetCurrentMoney } from "@/assets/js/rest/RestMethods";
|
|||||||
import { GetCookie } from "@/assets/js/storage/CookieStorage";
|
import { GetCookie } from "@/assets/js/storage/CookieStorage";
|
||||||
|
|
||||||
import { Howl } from 'howler';
|
import { Howl } from 'howler';
|
||||||
|
import {eventBus} from "@/main";
|
||||||
|
|
||||||
import { Swiper, SwiperSlide } from 'swiper/vue';
|
import { Swiper, SwiperSlide } from 'swiper/vue';
|
||||||
import 'swiper/css';
|
import 'swiper/css';
|
||||||
@@ -307,7 +308,7 @@ export default {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.ValidationPlay.endGame = false
|
this.ValidationPlay.endGame = false
|
||||||
}, 1200)
|
}, 1200)
|
||||||
return
|
return this.$emit('Updatebalance')
|
||||||
}
|
}
|
||||||
const SoundUncorrect = new Howl({
|
const SoundUncorrect = new Howl({
|
||||||
src: ['/sounds/correct-click.mp3'],
|
src: ['/sounds/correct-click.mp3'],
|
||||||
@@ -404,6 +405,7 @@ export default {
|
|||||||
this.gamesCircle = 0
|
this.gamesCircle = 0
|
||||||
await GetWinningAmount({ SearchToken: GetCookie('SearchToken'), AuthToken: GetCookie('AUTHTOKEN') })
|
await GetWinningAmount({ SearchToken: GetCookie('SearchToken'), AuthToken: GetCookie('AUTHTOKEN') })
|
||||||
this.winningAmount = 0
|
this.winningAmount = 0
|
||||||
|
return eventBus.emit('Updatebalance')
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
@@ -431,7 +433,7 @@ export default {
|
|||||||
if (this.flippedCards.includes(index)) {
|
if (this.flippedCards.includes(index)) {
|
||||||
// this.flippedCards.splice(this.flippedCards.indexOf(index), 1);
|
// this.flippedCards.splice(this.flippedCards.indexOf(index), 1);
|
||||||
// console.log(index, this.flippedCards)
|
// console.log(index, this.flippedCards)
|
||||||
return
|
return eventBus.emit('Updatebalance')
|
||||||
} else {
|
} else {
|
||||||
this.flippedCards.push(index);
|
this.flippedCards.push(index);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user