Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i got 2 functions, ones checks the login given and the other renders an icon based on if its correct or not,it doesn't work after checking slowly with debugged.
problem is once the main function ends , the entire page gets re-rendered for some reason and i lose the state of the classes.
in the debugger i get sent into a file That Starts With VM, in it:

onDoLogin(event)


any suggestions?

The Code:

function onDoLogin(e) {
  e.stopPropagation();
  var credentials = getUserCredentials();
  var isLogin = checkLoginCredentials(credentials);
  showLoginIndicator(isLogin);
}



function showLoginIndicator(isLoginSuccessful) {
  var goodLogin = document.querySelector(".login-good");
  var badLogin = document.querySelector(".login-bad");
  var adminLogin = document.querySelector(".admin-panel");
  var checkAdmin = isAdmin();
  if (isLoginSuccessful) goodLogin.classList.remove("hide");
  if (checkAdmin) adminLogin.classList.remove("hidden");
  if (!isLoginSuccessful) {
    badLogin.classList.remove("hide");
    return;
  }


}


What I have tried:

using a debugger, stopping propagation.
Posted
Comments
gggustafson 28-Mar-20 16:24pm    
You have not shown enough for us to help. Note that the debugger can interfere with execution. Normally this implies that there is some kind of timing issue in effect. What debugger are you using?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900