diff --git a/front-end/lib/api.mjs b/front-end/lib/api.mjs index f4b5339..e02fdee 100644 --- a/front-end/lib/api.mjs +++ b/front-end/lib/api.mjs @@ -138,6 +138,7 @@ async function signup(username, password) { function logout() { state.destroyState(); + window.location.hash = "/"; return {success: true}; } diff --git a/front-end/views/profile.mjs b/front-end/views/profile.mjs index dd2b92a..529cb47 100644 --- a/front-end/views/profile.mjs +++ b/front-end/views/profile.mjs @@ -38,9 +38,10 @@ function profileView(username) { "login-template", createLogin ); + document - .querySelector("[data-action='login']") - ?.addEventListener("click", handleLogin); + .querySelector("[data-form='login']") + ?.addEventListener("submit", handleLogin); const profileData = state.profiles.find((p) => p.username === username); if (profileData) {