diff --git a/luckydiamond/src/assets/js/rest/RestMethods.js b/luckydiamond/src/assets/js/rest/RestMethods.js index 8afc9b2..c835d8c 100644 --- a/luckydiamond/src/assets/js/rest/RestMethods.js +++ b/luckydiamond/src/assets/js/rest/RestMethods.js @@ -22,25 +22,26 @@ export async function Post(url = "", data = {}) { } } -export async function GetCurrentMoney(authToken) { +export async function GetCurrentMoney(authToken, searchToken) { try { - const response = await fetch(`${BackendApiUrl}/Payment/GetCurrentMoney`, { - method: 'GET', - headers: { - 'AuthToken': authToken, - } - }); - - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); + const response = await fetch(`${BackendApiUrl}/Payment/GetCurrentMoney`, { + method: 'GET', + headers: { + 'AUTHTOKEN': authToken, + 'SearchToken': searchToken } + }); - const data = await response.json(); - console.log(data); // Здесь вы можете обработать полученные данные - return data; + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const data = await response.json(); + console.log(data); // Здесь вы можете обработать полученные данные + return data; } catch (error) { - console.error('There was a problem with the fetch operation:', 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 f93eee1..6459d16 100644 --- a/luckydiamond/src/components/HeaderComponent.vue +++ b/luckydiamond/src/components/HeaderComponent.vue @@ -41,13 +41,21 @@ export default { this.imageUrl = this.imageUrl + `${response.spUserName}.png`; this.userName = response.spUserName; this.auth = true; + let currentMoney = GetCurrentMoney( + GetCookie("AuthToken"), + GetCookie("SearchToken") + ); + this.balance = currentMoney; }) .catch((error) => { console.error("Auth Code error:", error); }); } else { let currentUserName = GetCookie("SpUserName"); - + let currentMoney = GetCurrentMoney( + GetCookie("AuthToken"), + GetCookie("SearchToken") + ); // let currentMoney = GetCurrentMoney( // "2405bf72008f835c9f5b336a84d3efbd7a742b828ca41fcaab1c40ca842e6425" // ); @@ -56,7 +64,7 @@ export default { if (currentUserName) { this.imageUrl = this.imageUrl + `${currentUserName}.png`; this.auth = true; - // this.balance = currentMoney; + this.balance = currentMoney; } else { this.auth = false; }