Fix async

This commit is contained in:
Bruno Rybársky 2024-02-06 20:10:06 +01:00
parent ee20b77602
commit 3cf29154aa

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