From eaa274ccb2a6df9bb9e1c33562d7ebd1f63e9cd1 Mon Sep 17 00:00:00 2001 From: aliciawt Date: Tue, 23 Jun 2026 00:47:52 +0200 Subject: [PATCH] Fix: Resolve 501 error when logging in from profile page --- front-end/components/login.mjs | 2 ++ front-end/components/logout.mjs | 1 + front-end/index.html | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/front-end/components/login.mjs b/front-end/components/login.mjs index 165b16a5..1af8d1a1 100644 --- a/front-end/components/login.mjs +++ b/front-end/components/login.mjs @@ -30,6 +30,8 @@ async function handleLogin(event) { const password = formData.get("password"); await apiService.login(username, password); + + window.location.hash = "/"; } catch (error) { throw error; } finally { diff --git a/front-end/components/logout.mjs b/front-end/components/logout.mjs index 2c5ebe99..ebc2067b 100644 --- a/front-end/components/logout.mjs +++ b/front-end/components/logout.mjs @@ -16,6 +16,7 @@ function createLogout(template, isLoggedIn) { async function handleLogout(event) { try { apiService.logout(); + window.location.hash = '/login'; } catch (error) { throw error; } diff --git a/front-end/index.html b/front-end/index.html index 89d6b130..c64eb2c3 100644 --- a/front-end/index.html +++ b/front-end/index.html @@ -43,7 +43,7 @@

This Legacy Code project is coursework from Code Your Future