Hi,
I have started putting together the basic functionality for checking an email address and once I have this working I will then look to moving it to a lightbox and applying session tokens etc.
The code works in so far as it will redirect me to a page if the email exists and approved status is true but it doesn’t show #textError if the email does not exist. What am I missing?!!
export function btnLogin_click(event, $w) {
wixData.query("MembersOnly")
.eq('email', $w('#inputEmailAddress').value)
.eq('approved', true)
.find()
.then((results) => {
let items = results.items;
let item = items[0];
let email = item.email;
if (results.length > 0) {
console.log(email);
wixLocation.to("/isw");
}
else {
console.log("Email address does not exist");
$w('#textError').show()
}
})
.catch((err) => {
let errorMsg = err;
console.log(errorMsg);
});
}
Thank you so much for all your help.
Rachel