Hi there,
I want to show a message and direct users to a location after they click log in from the lightbox, but as soon as they click the button and log in is successful, the lightbox automatically closes. Is this by design or is it a bug I have introduced?
code below:
export function loginButton_click(event) {
let email = $w("#emailL").value;
let password = $w("#passwordL").value
wixUsers.login(email, password)
.then( ()=> {
console.log("user is logged in");
let user = wixUsers.currentUser;
if (user.loggedIn) {
wixData.query("Members/PrivateMembersData")
user.getRoles()
.then( (roles) => {
if(roles.length > 0) {
let firstRole = roles[0];
var roleName = firstRole.name;
let url = ("/")+roleName+("/");
console.log(url)
wixLocation.to(`${url}`);
console.log("directed to url");
}
else {
console.log("Member has no roles");
}
} )
}
console.log("all stuff complete");
})
.catch((err)=> {
console.log(err);
$w("#errorL").expand();
})
}
All console logs come through.
Many thanks
Adam