From 68fcaa654041227230d464664c441c3eb2726326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Sat, 3 Feb 2024 17:01:52 +0100 Subject: [PATCH] fix --- assets/script.js | 6 +++--- templates/adminActions.html | 10 +++++----- templates/login.html | 2 +- templates/register.html | 2 +- templates/userActions.html | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/assets/script.js b/assets/script.js index c533727..082caa1 100644 --- a/assets/script.js +++ b/assets/script.js @@ -1,5 +1,5 @@ -function doAction(requestData, successMessage, failureMessage) { - return fetch('https://home.adlerka.top/account', { +function doAccountAction(requestData, successMessage, failureMessage) { + return fetch('/account', { method: 'POST', body: requestData, }) @@ -32,6 +32,6 @@ function logout() { const data = new URLSearchParams(); data.append("action", "logout"); - doAction(data, "Logout Successful!", "Logout failed."); + doAccountAction(data, "Logout Successful!", "Logout failed."); } diff --git a/templates/adminActions.html b/templates/adminActions.html index 5ecb36e..f7ebb17 100644 --- a/templates/adminActions.html +++ b/templates/adminActions.html @@ -6,14 +6,14 @@ data.append("action", "add_activation_codes"); 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() { const data = new URLSearchParams(); 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") { displayUserList(result.Users); @@ -52,7 +52,7 @@ const data = new URLSearchParams(); 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() { @@ -62,7 +62,7 @@ data.append("action", "delete_user"); data.append("user_id", userId); - doAction(data, "User deleted Successfully!", "User deletion failed."); + doAccountAction(data, "User deleted Successfully!", "User deletion failed."); } function deleteActivationCode() { @@ -72,7 +72,7 @@ data.append("action", "delete_activation_code"); 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."); } diff --git a/templates/login.html b/templates/login.html index 7910a09..9d23de2 100644 --- a/templates/login.html +++ b/templates/login.html @@ -11,7 +11,7 @@ data.append("email", email); data.append("password", password); - doAction(data, "Login Successful!", "Login failed. Please check your credentials."); + doAccountAction(data, "Login Successful!", "Login failed. Please check your credentials."); } diff --git a/templates/register.html b/templates/register.html index 71941c9..ebb9ca3 100644 --- a/templates/register.html +++ b/templates/register.html @@ -22,7 +22,7 @@ } function doRegister(requestData) { - doAction(requestData, "Registration Successful!", "Registration failed."); + doAccountAction(requestData, "Registration Successful!", "Registration failed."); } diff --git a/templates/userActions.html b/templates/userActions.html index 389c4fc..a630463 100644 --- a/templates/userActions.html +++ b/templates/userActions.html @@ -12,7 +12,7 @@ } function doChangePassword(requestData, successMessage, failureMessage) { - doAction(requestData, successMessage, failureMessage); + doAccountAction(requestData, successMessage, failureMessage); } function updateUserProfile() { @@ -30,7 +30,7 @@ data.append("nickname", nickname); data.append("minecraft_nick", minecraftNick); - doAction(data, "Profile update Successful!", "Profile update failed."); + doAccountAction(data, "Profile update Successful!", "Profile update failed."); } async function getUserInfo() { @@ -40,7 +40,7 @@ data.append("action", "get_user_info"); 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") { displayUserInfo(result);