Login/Logout Functionality is Not Working

Hello! The following code was working until a few days ago to log members out and direct them to a dedicated Logout page when clicking on the Logout button in the header of my site. For some reason, it is no longer working. Here’s a link to a video showing what’s happening now.

import wixUsers from ‘wix-users’;
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;

$w.onReady( () => {
if(wixUsers.currentUser.loggedIn) {
$w(“#button48”).label = “Logout”;
$w(“#button49”).show();
$w(“#image8”).show();

}
else {
$w(“#button48”).label = “Login/Register”;
$w(“#button49”).hide();
$w(“#image8”).hide();

}
} );

export function button48_onclick() {
// user is logged in
if(wixUsers.currentUser.loggedIn) {
// log the user out
wixUsers.logout()
.then( () => {
// update buttons accordingly
$w(“#button48”).label = “Login/Register”;
$w(“#button49”).hide();
$w(“#image8”).hide();
wixUsers.logout();
wixLocation.to(‘/logout’);

} ); 

}
// user is logged out
else {
let userId;
let userEmail;

// prompt the user to log in  
wixUsers.promptLogin( {"mode": "login"} ) 
  .then( (user) => { 
    userId = user.id; 
    return user.getEmail(); 
  } ) 
  .then( (email) => { 
    // check if there is an item for the user in the collection 
    userEmail = email; 
    return wixData.query("Profile") 
      .eq("_id", userId) 
      .find(); 
  } ) 
  .then( (results) => { 
    // if an item for the user is not found 
    if (results.items.length === 0) { 
      // create an item 
      const toInsert = { 
        "_id": userId, 
        "email": userEmail 
      }; 
      // add the item to the collection 
      wixData.insert("Profile", toInsert) 
        .catch( (err) => { 
          console.log(err); 
        } ); 
    } 
    // update buttons accordingly 
    $w("#button48").label = "Logout"; 
    $w("#button49").show(); 
    $w("#image8").show(); 
    wixLocation.to('/login'); 
   
  } ) 
 
  .catch( (err) => { 
    console.log(err); 
  } ); 

}
}

export function button49_onclick() { wixLocation.to(/Profile/Dashboard/${wixUsers.currentUser.id});
}

export function image8_onclick() { wixLocation.to(/Profile/Update/${wixUsers.currentUser.id});
}