diff --git a/assets/script.js b/assets/script.js index b435690..a888a45 100644 --- a/assets/script.js +++ b/assets/script.js @@ -6,7 +6,7 @@ toggleButton.addEventListener('click', () => { }) -let UserInfo; +var UserInfo; function handleResponse(data, successMessage, failureMessage) { const statusMessageContainer = document.getElementById("statusMessageContainer"); @@ -325,11 +325,11 @@ function getUserInfo() { action: "get_user_info", }; - const result = doAction('/account', data, "User info retrieved Successfully!", "User info retrieval failed.", true); - - if (result && result.Status === "Success") { - UserInfo = result.UserInfo; - } + doAction('/account', data, "User info retrieved Successfully!", "User info retrieval failed.", true) .then((result) => { + if (result && result.Status === "Success") { + UserInfo = result.UserInfo; + } + }); } //User settings end @@ -344,10 +344,10 @@ function addActivationCodes() { count: count, }; - const result = doAction('/account', data, "Activation codes added Successfully!", "Activation codes addition failed."); - - displayList(result.ActivationCodes, "codeListTable", deleteActivationCode); - umami.track("addActivationCodes"); + doAction('/account', data, "Activation codes added Successfully!", "Activation codes addition failed.").then((result) => { + displayList(result.ActivationCodes, "codeListTable", deleteActivationCode); + umami.track("addActivationCodes"); + }); } function listUsers() { @@ -355,11 +355,12 @@ function listUsers() { action: "list_users", }; - const result = doAction('/account', data, "User list retrieved Successfully!", "User list retrieval failed."); + doAction('/account', data, "User list retrieved Successfully!", "User list retrieval failed.").then((result) => { - if (result && result.Status === "Success") { - displayList(result.Users, "userListTable", deleteUser); - } + if (result && result.Status === "Success") { + displayList(result.Users, "userListTable", deleteUser); + } + }); } function listActivationCodes() { @@ -367,9 +368,9 @@ function listActivationCodes() { action: "list_activation_codes", }; - const result = doAction('/account', data, "Activation code list retrieved Successfully!", "Activation code list retrieval failed."); - - displayList(result.ActivationCodes, "codeListTable", deleteActivationCode); + doAction('/account', data, "Activation code list retrieved Successfully!", "Activation code list retrieval failed.").then((result) => { + displayList(result.ActivationCodes, "codeListTable", deleteActivationCode); + }); } function deleteUser(userId) {