function hideLoginButton() {
    var loginButton = document.getElementById("login-button");
    var logoutButton = document.getElementById("logout-button");
    var commentForm = document.getElementById("comment-form");    

    // fetch and hide/show a button. none == hide
    fetch('/login').then(response => response.json()).then(data => {
        if (data.isLoggedIn) {
            loginButton.hidden = true;
            logoutButton.hidden = false;
            commentForm.hidden = false;
        } else {
            loginButton.hidden = false;
            logoutButton.hidden = true;
            commentForm.hidden = true;
        }
    });

}
// hide either logIn/logOut button according to fetched status
hide either logIn/logOut button according to fetched status
hide either logIn / logOut button according to fetched status
function hideLoginButton() {
    var loginButton = document.getElementById("login-button");
    var logoutButton = document.getElementById("logout-button");
    var commentForm = document.getElementById("comment-form");    
    fetch('/login').then(response => response.json()).then(data => {
        if (data.isLoggedIn) {
            loginButton.hidden = true;
            logoutButton.hidden = false;
            commentForm.hidden = false;
        } else {
            loginButton.hidden = false;
            logoutButton.hidden = true;
            commentForm.hidden = true;
        }
    });
}
function hideLoginButton ( ) { var loginButton = document . getElementById ( "login-button" ) ; var logoutButton = document . getElementById ( "logout-button" ) ; var commentForm = document . getElementById ( "comment-form" ) ; fetch ( '/login' ) . then ( response => response . json ( ) ) . then ( data => { if ( data . isLoggedIn ) { loginButton . hidden = true ; logoutButton . hidden = false ; commentForm . hidden = false ; } else { loginButton . hidden = false ; logoutButton . hidden = true ; commentForm . hidden = true ; } } ) ; }
hide either logIn/logOut button according to fetched status
hide either logIn / logOut button according to fetched status
// fetch and hide/show a button. none == hide