Skip to content
Snippets Groups Projects
Commit 0d3a9a29 authored by schneider210's avatar schneider210
Browse files

fix: logic to display any items on empty search

parent 638383ac
No related branches found
No related tags found
1 merge request!60loading indicator for search
Pipeline #219822 passed
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
class="loading-wrapper py-10" class="loading-wrapper py-10"
> >
<v-progress-circular <v-progress-circular
v-if="loading"
color="primary" color="primary"
size="50" size="50"
indeterminate indeterminate
...@@ -78,12 +77,16 @@ export default { ...@@ -78,12 +77,16 @@ export default {
onSearchInput(query) { onSearchInput(query) {
this.query = query; this.query = query;
this.page = 1; this.page = 1;
this.search(this.query, 0, this.size) this.search(this.query, 0, this.size)
}, },
async search(value, from, size) { async search(value, from, size) {
this.loading = false;
try { try {
this.items = [];
this.total = 0;
this.loading = true;
const searchResponse = await apiService.search(value, from, size); const searchResponse = await apiService.search(value, from, size);
const items = searchResponse.hits?.hits; const items = searchResponse.hits?.hits;
...@@ -92,9 +95,10 @@ export default { ...@@ -92,9 +95,10 @@ export default {
this.items = items.map(x => ({ ...x, searchTerm: value })); this.items = items.map(x => ({ ...x, searchTerm: value }));
} }
} catch(error) { } catch(error) {
// console.log(error.message); this.items = [];
this.total = 0;
} finally { } finally {
this.loading = true; this.loading = false;
} }
}, },
scrollUp() { scrollUp() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment