From 1abb58e267408d2828397a8108e9f0e7b90b9871 Mon Sep 17 00:00:00 2001 From: Hepatica Date: Sat, 2 Dec 2023 06:46:25 +0100 Subject: [PATCH] ad then events --- .../src/components/HeaderComponent.vue | 55 +++++++++++++------ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/luckydiamond/src/components/HeaderComponent.vue b/luckydiamond/src/components/HeaderComponent.vue index 078329c..84c8e82 100644 --- a/luckydiamond/src/components/HeaderComponent.vue +++ b/luckydiamond/src/components/HeaderComponent.vue @@ -41,39 +41,62 @@ export default { this.imageUrl = this.imageUrl + `${response.spUserName}.png`; this.userName = response.spUserName; this.auth = true; - let currentMoney = GetCurrentMoney( - response.authtoken, - response.searchToken - ); - this.balance = currentMoney; + GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken")) + .then((response) => { + this.balance = response.currentMoney; + console.log(response); + }) + .catch((error) => { + // Обработка ошибки + console.error(error); + }); + + // let currentMoney = GetCurrentMoney( + // response.authtoken, + // response.searchToken + // ); + // this.balance = currentMoney; }) .catch(() => { let currentUserName = GetCookie("SpUserName"); - let currentMoney = GetCurrentMoney( - GetCookie("AUTHTOKEN"), - GetCookie("SearchToken") - ); + + // let currentMoney = GetCurrentMoney( + // GetCookie("AUTHTOKEN"), + // GetCookie("SearchToken") + // ).then(response); + + GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken")) + .then((response) => { + this.balance = response.currentMoney; + console.log(response); + }) + .catch((error) => { + // Обработка ошибки + console.error(error); + }); if (currentUserName) { this.imageUrl = this.imageUrl + `${currentUserName}.png`; this.auth = true; - this.balance = currentMoney; } else { this.auth = false; } - }); } else { let currentUserName = GetCookie("SpUserName"); - let currentMoney = GetCurrentMoney( - GetCookie("AUTHTOKEN"), - GetCookie("SearchToken") - ); + GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken")) + .then((response) => { + this.balance = response.currentMoney; + console.log(response); + }) + .catch((error) => { + // Обработка ошибки + console.error(error); + }); if (currentUserName) { this.imageUrl = this.imageUrl + `${currentUserName}.png`; this.auth = true; - this.balance = currentMoney; } else { this.auth = false; }