Emit search error when not typing search term

This commit is contained in:
William Buezas 2024-12-03 12:36:34 -03:00
parent 9fb67992ae
commit e7289b05e9
2 changed files with 13 additions and 1 deletions

View File

@ -40,6 +40,11 @@ const search = async () => {
query: searchTerm.value ? { search: searchTerm.value } : {}
});
if (!searchTerm.value) {
emit('onSearchError');
return;
}
if (props.sqlQuery) {
data = await jApi.query(props.sqlQuery, {
[props.searchField]: searchTerm.value

View File

@ -1,7 +1,14 @@
<template>
<Teleport v-if="isHeaderMounted" to="#actions">
<div class="row">
<VnSearchBar :search-term="search" @on-search-error="items = []" />
<VnSearchBar
@on-search-error="
() => {
items = [];
search = '';
}
"
/>
<QBtn
:icon="viewTypeButtonContent.icon"
:label="viewTypeButtonContent.label"