Ive put together a simple query to display search results in a repeater, Im trying to figure out how to handle the case where no matching items are found and display an error message. The search part works when my search matches an item in the database, but when no matching items are found nothing shows up, the repeater isnt filled out or shown. Any help is significantly appreciated!
export function button2_click() {
search();
}
function search() {
wixData.query('TravelLocations')
.contains("location", $w("#input4").value)
.find()
.then( (results) => {
if (results.items.length > 0) {
$w('#repeater1').data = results.items;
$w('#repeater1').show();
}
else {
$w("#box2").show
}
})
}