From 716c19053a13f91c91b83d0f155b3f840bc5bf6e Mon Sep 17 00:00:00 2001 From: Sara Tahir Date: Wed, 4 Feb 2026 14:30:46 +0000 Subject: [PATCH] fix login from profile view. --- front-end/views/profile.mjs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/front-end/views/profile.mjs b/front-end/views/profile.mjs index dd2b92a..4ac44d4 100644 --- a/front-end/views/profile.mjs +++ b/front-end/views/profile.mjs @@ -39,9 +39,8 @@ function profileView(username) { createLogin ); document - .querySelector("[data-action='login']") - ?.addEventListener("click", handleLogin); - + .querySelector("[data-form='login']")//data-action triggers a certain behavior and data-form = login is a component identity for loginform + ?.addEventListener("submit", handleLogin); //js listen to a submit event on the form not a click event. const profileData = state.profiles.find((p) => p.username === username); if (profileData) { renderOne(