portfolio/src/main/webapp/script.js
/** Allow the user to login, when logged in -> display contact form */
Allow the user to login, when logged in -> display contact form
Allow the user to login when logged in - > display contact form
function userLogin() {
  fetch('/login').then((response) => response.json()).then((currUser) => {
    document.getElementById('form-overlay-text').innerHTML =
        currUser.loginMessage;
    if (currUser.isLoggedIn) {
      document.getElementById('form-overlay').style.display = 'block';
      document.getElementById('delete-btn').style.display = 'inline';
    } else {
      document.getElementById('form-overlay').style.display = 'none';
      document.getElementById('delete-btn').style.display = 'none';
    }
  });
}
function userLogin ( ) { fetch ( '/login' ) . then ( ( response ) => response . json ( ) ) . then ( ( currUser ) => { document . getElementById ( 'form-overlay-text' ) . innerHTML = currUser . loginMessage ; if ( currUser . isLoggedIn ) { document . getElementById ( 'form-overlay' ) . style . display = 'block' ; document . getElementById ( 'delete-btn' ) . style . display = 'inline' ; } else { document . getElementById ( 'form-overlay' ) . style . display = 'none' ; document . getElementById ( 'delete-btn' ) . style . display = 'none' ; } } ) ; }
Allow the user to login, when logged in -> display contact form
Allow the user to login when logged in - > display contact form