Detect wallet disconnect

How would I detect in my web app that a user has disconnected their wallet? I am using vanilla js and this function to connect.

        user = await Moralis
            .authenticate({signingMessage: "Log in"})
            .then(function (user) {
                console.log("logged in user:", user);
                userAddress = user.get("ethAddress");
                currentUserWallet = user.get("ethAddress");
            .catch(function (error) {

If there is no wallet data under Moralis.User.current() then there is no active user.

I am still able to get the current user’s wallet address by calling…

function showUser(){
    let user = Moralis

even after I disconnected using metamask's disconnect.

I have been able to detect walletconnect connection disconnecting by using this…

Moralis.provider.on("disconnect", (error, payload) => {

but,this does not work for Metamask. Any ideas on how to get it to work?

Moralis.User.current() will return null if the logout is successful.