How to get new user data after changing the account

When I switch between my accounts in MetaMask, I need to set the new User data according to the new account.

await setUserData({ "ethAddress": newEthAddress });

After setting the user data using this function, I called this function to get the new user Data,

const newUser = Moralis.User.current();
console.log("newUser", newUser);

But in here, I am not getting the new userData.


you can try to make a query to get the new data

Is there any way to switch the Moralis.User object according to the new account,

await setUserData({ "ethAddress": newEthAddress });

This function only sets ethAddress attribute value for current Moralis.User object. I just need to switch the whole Moralis.User object when I switch my MetaMask account.

Iā€™m not sure that you can update the user ETH Address, if you look in the dashboard it was updated?