diff --git a/luckydiamond/src/assets/js/rest/RestMethods.js b/luckydiamond/src/assets/js/rest/RestMethods.js index 2c7f286..8575d07 100644 --- a/luckydiamond/src/assets/js/rest/RestMethods.js +++ b/luckydiamond/src/assets/js/rest/RestMethods.js @@ -40,7 +40,7 @@ export async function GetCurrentMoney(authToken, searchToken) { } const data = await response.json(); - console.log(data); // Здесь вы можете обработать полученные данные + console.log(data); return data; } catch (error) { console.error('There was a problem with the fetch operation:', error); diff --git a/luckydiamond/src/components/HeaderComponent.vue b/luckydiamond/src/components/HeaderComponent.vue index 6e26a1e..9de2ea4 100644 --- a/luckydiamond/src/components/HeaderComponent.vue +++ b/luckydiamond/src/components/HeaderComponent.vue @@ -42,24 +42,32 @@ export default { this.userName = response.spUserName; this.auth = true; let currentMoney = GetCurrentMoney( - GetCookie("AuthToken"), - GetCookie("SearchToken") + response.authtoken, + response.searchToken ); - this.balance = currentMoney; + this.balance = currentMoney; }) .catch((error) => { - console.error("Auth Code error:", error); + let currentUserName = GetCookie("SpUserName"); + let currentMoney = GetCurrentMoney( + GetCookie("AUTHTOKEN"), + GetCookie("SearchToken") + ); + + 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") - ); - // let currentMoney = GetCurrentMoney( - // "2405bf72008f835c9f5b336a84d3efbd7a742b828ca41fcaab1c40ca842e6425" - // ); - // let currentMoney = GetCurrentMoney(GetCookie("AuthToken")); + GetCookie("AUTHTOKEN"), + GetCookie("SearchToken") + ); if (currentUserName) { this.imageUrl = this.imageUrl + `${currentUserName}.png`;