Hi Or,
Here are my codes:
export function ProfileButton_click() {
//The log-in process is prompted
if (wixUsers.currentUser.loggedIn) {
//If the user is logged in and decides to log out
wixUsers.logout()
.then( (result) => {
// update buttons accordingly
wixLocation.to(/successfullogout); //This does not work
$w(‘#loginButton’).label = “Login/Register”;
$w(‘#button39’).show();
$w(‘#button10’).show();
$w(‘#box11’).show();
$w(‘#ProfileButton’).show();
$w(‘#profileButton’).hide();
$w(‘#CoffeeButton’).hide();
})
. catch ((err) => {
console.log(err);
});
}
// user is logged out
else {
wixLocation.to(/login);//This works
}
}