I have the main.js script which executes the authenticating function and creates a variable called user.
user = Moralis.User.current();
I have a script.js that follows main.js which has a launch function that checks if a user is logged in and renders a game canvas/dom element.
let user = Moralis.User.current();
if (!user){
console.log("no user");
//user = await Moralis.Web3.authenticate();
}
else
{
console.log(user.get("ethAddress")+" "+'logged in');
game = new Phaser.Game(config);
}
})()```
How do i call the launch function immediately as soon as my user is authenticated.
Everytime I log in, the console reads "no user"