This commit is contained in:
Bruno Rybársky 2024-02-03 17:01:52 +01:00
parent fcb556914c
commit 68fcaa6540
5 changed files with 13 additions and 13 deletions

@ -1,5 +1,5 @@
function doAction(requestData, successMessage, failureMessage) { function doAccountAction(requestData, successMessage, failureMessage) {
return fetch('https://home.adlerka.top/account', { return fetch('/account', {
method: 'POST', method: 'POST',
body: requestData, body: requestData,
}) })
@ -32,6 +32,6 @@ function logout() {
const data = new URLSearchParams(); const data = new URLSearchParams();
data.append("action", "logout"); data.append("action", "logout");
doAction(data, "Logout Successful!", "Logout failed."); doAccountAction(data, "Logout Successful!", "Logout failed.");
} }

@ -6,14 +6,14 @@
data.append("action", "add_activation_codes"); data.append("action", "add_activation_codes");
data.append("count", count); data.append("count", count);
doAction(data, "Activation codes added Successfully!", "Activation codes addition failed."); doAccountAction(data, "Activation codes added Successfully!", "Activation codes addition failed.");
} }
async function listUsers() { async function listUsers() {
const data = new URLSearchParams(); const data = new URLSearchParams();
data.append("action", "list_users"); data.append("action", "list_users");
const result = await doAction(data, "User list retrieved Successfully!", "User list retrieval failed."); const result = await doAccountAction(data, "User list retrieved Successfully!", "User list retrieval failed.");
if (result && result.Status === "Success") { if (result && result.Status === "Success") {
displayUserList(result.Users); displayUserList(result.Users);
@ -52,7 +52,7 @@
const data = new URLSearchParams(); const data = new URLSearchParams();
data.append("action", "list_activation_codes"); data.append("action", "list_activation_codes");
doAction(data, "Activation code list retrieved Successfully!", "Activation code list retrieval failed."); doAccountAction(data, "Activation code list retrieved Successfully!", "Activation code list retrieval failed.");
} }
function deleteUser() { function deleteUser() {
@ -62,7 +62,7 @@
data.append("action", "delete_user"); data.append("action", "delete_user");
data.append("user_id", userId); data.append("user_id", userId);
doAction(data, "User deleted Successfully!", "User deletion failed."); doAccountAction(data, "User deleted Successfully!", "User deletion failed.");
} }
function deleteActivationCode() { function deleteActivationCode() {
@ -72,7 +72,7 @@
data.append("action", "delete_activation_code"); data.append("action", "delete_activation_code");
data.append("activation_code", activationCode); data.append("activation_code", activationCode);
doAction(data, "Activation code deleted Successfully!", "Activation code deletion failed."); doAccountAction(data, "Activation code deleted Successfully!", "Activation code deletion failed.");
} }
</script> </script>

@ -11,7 +11,7 @@
data.append("email", email); data.append("email", email);
data.append("password", password); data.append("password", password);
doAction(data, "Login Successful!", "Login failed. Please check your credentials."); doAccountAction(data, "Login Successful!", "Login failed. Please check your credentials.");
} }
</script> </script>

@ -22,7 +22,7 @@
} }
function doRegister(requestData) { function doRegister(requestData) {
doAction(requestData, "Registration Successful!", "Registration failed."); doAccountAction(requestData, "Registration Successful!", "Registration failed.");
} }
</script> </script>

@ -12,7 +12,7 @@
} }
function doChangePassword(requestData, successMessage, failureMessage) { function doChangePassword(requestData, successMessage, failureMessage) {
doAction(requestData, successMessage, failureMessage); doAccountAction(requestData, successMessage, failureMessage);
} }
function updateUserProfile() { function updateUserProfile() {
@ -30,7 +30,7 @@
data.append("nickname", nickname); data.append("nickname", nickname);
data.append("minecraft_nick", minecraftNick); data.append("minecraft_nick", minecraftNick);
doAction(data, "Profile update Successful!", "Profile update failed."); doAccountAction(data, "Profile update Successful!", "Profile update failed.");
} }
async function getUserInfo() { async function getUserInfo() {
@ -40,7 +40,7 @@
data.append("action", "get_user_info"); data.append("action", "get_user_info");
data.append("user_id", userId); data.append("user_id", userId);
const result = await doAction(data, "User info retrieved Successfully!", "User info retrieval failed."); const result = await doAccountAction(data, "User info retrieved Successfully!", "User info retrieval failed.");
if (result && result.Status === "Success") { if (result && result.Status === "Success") {
displayUserInfo(result); displayUserInfo(result);