Reload search page if searching again and already in search tab

This commit is contained in:
RemixDev 2020-09-24 13:48:37 +02:00
parent c1198037a8
commit aaecaab04d
3 changed files with 19 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@ -156,6 +156,7 @@ export default {
mounted() {
EventBus.$on('mainSearch:checkLoadMoreContent', this.checkLoadMoreContent)
this.$root.$on('mainSearch:showNewResults', this.checkIfShowNewResults)
this.$root.$on('mainSearch:updateResults', this.checkIfUpdateResults)
socket.on('mainSearch', this.handleMainSearch)
socket.on('search', this.handleSearch)
@ -186,6 +187,15 @@ export default {
this.showNewResults(term)
}
},
checkIfUpdateResults(term, mainSelected) {
let needToUpdateSearch = term === this.results.query && this.currentTab.searchType !== 'all'
if (needToUpdateSearch) {
let resetObj = { data: [], next: 0, total: 0, loaded: false }
this.results[this.currentTab.searchType+"Tab"] = { ...resetObj }
this.search(this.currentTab.searchType)
}
},
showNewResults(term) {
socket.emit('mainSearch', { term })

View File

@ -75,7 +75,10 @@ export default {
}
}
} else {
if (isShowingSearch && sameAsLastSearch) return
if (isShowingSearch && sameAsLastSearch){
this.$root.$emit('mainSearch:updateResults', term, window.main_selected)
return
}
if (!isShowingSearch) {
await this.$router.push({