From 4d20b49002ec5ddee82531923aa8f4d6557dfe78 Mon Sep 17 00:00:00 2001 From: Fu Zi Xiang Date: Fri, 13 Oct 2023 14:10:06 +0800 Subject: [PATCH] chore: javascript formatting --- admin_frontend/templates/admin.html | 1 - admin_frontend/templates/home.html | 33 +++++----- admin_frontend/templates/login.html | 27 ++++---- admin_frontend/templates/user_details.html | 76 ++++++++++++---------- admin_frontend/templates/users.html | 54 ++++++++------- 5 files changed, 100 insertions(+), 91 deletions(-) diff --git a/admin_frontend/templates/admin.html b/admin_frontend/templates/admin.html index 4a124845..addb00dd 100644 --- a/admin_frontend/templates/admin.html +++ b/admin_frontend/templates/admin.html @@ -8,7 +8,6 @@ document .getElementById("usersBtn") .addEventListener("click", function () { - // Redirect to the users page. window.location.href = "/web/admin/users"; }); diff --git a/admin_frontend/templates/home.html b/admin_frontend/templates/home.html index 4d38aca8..99d405e0 100644 --- a/admin_frontend/templates/home.html +++ b/admin_frontend/templates/home.html @@ -1,15 +1,14 @@ -
-

User Management

-

Welcome, {{ email }}

+

User Management

+

Welcome, {{ email }}

diff --git a/admin_frontend/templates/login.html b/admin_frontend/templates/login.html index 8a1d80ef..6bcde6d3 100644 --- a/admin_frontend/templates/login.html +++ b/admin_frontend/templates/login.html @@ -39,20 +39,21 @@ "Content-Type": "application/json", }, body: JSON.stringify(data), - credentials: 'same-origin', + credentials: "same-origin", }) - .then((response) => { - if (!response.ok) { - // If HTTP status code is not OK, throw an error with the status text - throw Error(response.statusText); - } - window.location.href = "/web/home"; - }) - .catch((error) => { - console.error("Error:", error); - document.getElementById("response").innerText = - "Login failed: " + error.message; - }); + .then((response) => { + if (!response.ok) { + // If HTTP status code is not OK, throw an error with the status text + throw Error(response.statusText); + } + window.location.href = "/web/home"; + }) + .catch((error) => { + console.error(`Error:, ${error}`); + document.getElementById( + "response", + ).innerText = `Login failed: ${error.message}`; + }); }); diff --git a/admin_frontend/templates/user_details.html b/admin_frontend/templates/user_details.html index 45e45fda..b68f775d 100644 --- a/admin_frontend/templates/user_details.html +++ b/admin_frontend/templates/user_details.html @@ -8,14 +8,14 @@ -