Hi,
so i was able to almost recode everything in my app for the new Moralis SDK. One last thing is my old “Check if user is already logged in function”
That was the function i used before… but it is not working correctly anymore… after people switching accounts on metamaks for example the currentUser stays the same here.
async function init()
{
const currentUser = Moralis.User.current();
if (currentUser) {
const userAddress = currentUser.get("ethAddress");
//doing something here
} else {
//doing something here
}
}
so i am tried to recode this function to:
async function init()
{
const currentUser = await Moralis.account;
if (currentUser) {
const userAddress = currentUser;
//doing something here
} else {
// show the signup or login page
}
}
but the currentUser here is always null if i refresh the page. Do i miss something here?
greetings