async function isUserLoggedIn(){
    if (user = await Moralis.User.current()){
        console.log("Metamask User is logged on")
        document.getElementById("status").innerText = `Logged in with ${user.get('accounts')[0].substring(0, 42)} `
        document.getElementById("Login").style.display = "none";
        document.getElementById("Logout").style.display = "block";
        document.getElementById("profile").style.display = "block";
        document.getElementById('nick').innerText = user.get('nick')
        document.getElementById('wallet').innerText = user.get('accounts')[0]
        document.getElementById('email').innerText = user.get('email')
    } else if (!user){
        console.log("Metamask User is not logged on")
        document.getElementById("status").innerText = ""
        document.getElementById("Login").style.display = "block";
        document.getElementById("Logout").style.display = "none";
        document.getElementById("profile").style.display = "none";
    }
}
//detect if user logged in or out. For updating frontend

detect if user logged in or out. For updating frontend
detect if user logged in or out . For updating frontend
async function isUserLoggedIn(){
    if (user = await Moralis.User.current()){
        console.log("Metamask User is logged on")
        document.getElementById("status").innerText = `Logged in with ${user.get('accounts')[0].substring(0, 42)} `
        document.getElementById("Login").style.display = "none";
        document.getElementById("Logout").style.display = "block";
        document.getElementById("profile").style.display = "block";
        document.getElementById('nick').innerText = user.get('nick')
        document.getElementById('wallet').innerText = user.get('accounts')[0]
        document.getElementById('email').innerText = user.get('email')
    } else if (!user){
        console.log("Metamask User is not logged on")
        document.getElementById("status").innerText = ""
        document.getElementById("Login").style.display = "block";
        document.getElementById("Logout").style.display = "none";
        document.getElementById("profile").style.display = "none";
    }
}
async function isUserLoggedIn ( ) { if ( user = await Moralis . User . current ( ) ) { console . log ( "Metamask User is logged on" ) document . getElementById ( "status" ) . innerText = ` ${ user . get ( 'accounts' ) [ 0 ] . substring ( 0 , 42 ) } ` document . getElementById ( "Login" ) . style . display = "none" ; document . getElementById ( "Logout" ) . style . display = "block" ; document . getElementById ( "profile" ) . style . display = "block" ; document . getElementById ( 'nick' ) . innerText = user . get ( 'nick' ) document . getElementById ( 'wallet' ) . innerText = user . get ( 'accounts' ) [ 0 ] document . getElementById ( 'email' ) . innerText = user . get ( 'email' ) } else if ( ! user ) { console . log ( "Metamask User is not logged on" ) document . getElementById ( "status" ) . innerText = "" document . getElementById ( "Login" ) . style . display = "block" ; document . getElementById ( "Logout" ) . style . display = "none" ; document . getElementById ( "profile" ) . style . display = "none" ; } }
detect if user logged in or out.
detect if user logged in or out .