It works for me as the same page refreshes whenever the member logs in. it is not set to change to another page and return.
The 2 buttons switched between show and hide. Before adding the code, I need to manually refresh the page to switch the buttons.
import wixData from “wix-data”;
import wixBookings from “wix-bookings”;
import wixUsers from ‘wix-users’;
////
$w.onReady( () => {
setupPage();
wixUsers.onLogin( (user) => {
setupPage();
} );
} );
exportfunction setupPage() {
if (wixUsers.currentUser.loggedIn) {
$w(“#bookButton”).show()
$w(‘#loginButton’).hide()
}
else {
$w(‘#loginButton’).show();
$w(“#bookButton”).hide()
}
}