mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-11 10:06:53 +08:00
Merge pull request #7551 from rekonder/aj_SCI_10697
Fix loading full view for global search results [SCI-10697]
This commit is contained in:
commit
65a78f6213
1 changed files with 17 additions and 10 deletions
|
@ -112,8 +112,10 @@ export default {
|
|||
loadData() {
|
||||
if (this.query.length < 2) return;
|
||||
|
||||
if (this.loading && this.page) return;
|
||||
if (this.loading && this.page && !(this.selected && !this.fullDataLoaded)) return;
|
||||
|
||||
const fullView = this.selected;
|
||||
const currentPage = this.page;
|
||||
this.loading = true;
|
||||
axios.get(this.searchUrl, {
|
||||
params: {
|
||||
|
@ -121,21 +123,26 @@ export default {
|
|||
sort: this.sort,
|
||||
filters: this.filters,
|
||||
group: this.group,
|
||||
preview: !this.selected,
|
||||
page: this.page
|
||||
preview: !fullView,
|
||||
page: currentPage
|
||||
}
|
||||
})
|
||||
.then((response) => {
|
||||
if (this.selected) this.fullDataLoaded = true;
|
||||
|
||||
if (this.selected === fullView && this.page === currentPage) {
|
||||
this.results = this.results.concat(response.data.data);
|
||||
this.total = response.data.meta.total;
|
||||
this.disabled = response.data.meta.disabled;
|
||||
this.loading = false;
|
||||
this.page = response.data.meta.next_page;
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
if (this.selected === fullView) {
|
||||
this.loading = false;
|
||||
this.$emit('updated');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue