added dinamic-update for balance

This commit is contained in:
Kostya
2024-01-26 00:06:09 +03:00
parent bd8b3d6dcc
commit 13367b0243
2 changed files with 18 additions and 2 deletions

View File

@@ -4,6 +4,9 @@ import "@/assets/css/ComponentsStyles/header.css";
// import { GetAuthCodeFromCurrentPath } from '@/assets/js/authentication/LoggingMiddleware.js';
import { LogIn } from "@/assets/js/authentication/AuthService.js";
import { GetCurrentMoney } from "@/assets/js/rest/RestMethods.js";
import {eventBus} from "@/main";
import {
SetCookie,
GetCookie,
@@ -18,6 +21,12 @@ export default {
this.balance = 0;
DeleteAllCookie();
},
updateBalanceMethod() {
GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken"))
.then(response => {
this.balance = response.currentMoney
})
}
},
data() {
return {
@@ -27,6 +36,11 @@ export default {
userName: "",
};
},
mounted() {
eventBus.on('Updatebalance', () => {
this.updateBalanceMethod()
})
},
created() {
try {
let authCode = this.$route.query.code;