Is there something wrong with codes ? I was creating rariable with YouTube tutorial but something went wrong and even I start to wrote everything over again , it doesn't work

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Morarable</title>
</head>
<body>
    <div>
        <button id="btnConnect">Connect Wallet</button>
        <button id="btnUserInfo">Profile</button>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
    <script src="https://unpkg.com/moralis/dist/moralis.js"></script>
    <script src="main.js"></script>
</body>
</html>


Moralis.initialize("ZXWROo2ku2pE3hxcxacHgP4cMdCRnUhHCD6SnaMt");
Moralis.serverURL = 'https://n392ycmmgqr5.moralis.io:2053/server' 

init = async () => {
    window.web3 = await Moralis.Web3.enable();
    initUser();
}

initUser = async () => {
    if (await Moralis.User.current()){
        hideElement(userConnectButton);
        showElement(userProfileButton);
    }else{
        showElement(userConnectButton);
        hideElement(userProfileButton);
    }        
}

login = async () => {
    try {
        await Moralis.Web3.authenicate();
        initUser();
    } catch (error) {
        alert(error)
    }
}

hideElement = (element) => element.style.display = "none";
showElement = (element) => element.style.display = "block";

const userConnectButton = document.getElementById("btnConnect");
userConnectButton.onclick = login;

const userProfileButton = document.getElementById("btnUserInfo");

init();

authenicate it is because of that . it should be authenitcate , i wrote that wrong and you should start your local host again. Thank you so much

1 Like

ok great that it works