Hello, I have written this code`
import wixData from 'wix-data';
import wixLocation from 'wix-location';
export function button12_click(event, $w) {
let nfc = $w('#nfc').value;
wixData.query("AllStudents")
.eq('nfcId', nfc)
.find()
.then((results) => {
if (results.items.length > 0) {
wixLocation.to(`/pttcowp-student/clubcard/${results.items[0]._id}`);
}
if (results.items.length === 0) {
$w('#text113').show();
}
})
.catch((err) => {
console.log("err", err);
});
}
Before going to the dynamic page, I want the code to check if the filed “status” in the database is checked. If it is checked then it will take me to the dynamic page, If it is not, it will show the error text,
Please, can someone tell me how can I make this work?
Thanks in advance!!