i have added a button on my home page connected to a light box. nothing is changing on click neither it is logging out or opening the light box. please find the code below, appreciate your help :
import wixUsers from ‘wix-users’;
import wixWindow from ‘wix-window’;
import wixData from ‘wix-data’;
$w.onReady( () => {
if (wixUsers.currentUser.loggedIn) {$w(“#loginbutton”).label = “Logout”;}
else {
$w(“#loginbutton”).label = “Login”;
}
});
export function loginbutton_click(event) {
if (wixUsers.currentUser.loggedIn) {
// log the user out
wixUsers.logout()
.then( () => {
// update buttons accordingly
$w(“#loginbutton”).label = “Login”;
} );}
else {
wixWindow.openLightbox(“loginlightbox”);
}
}
// user is logged out