Fix router management

This commit is contained in:
Chocobozzz 2020-09-02 11:09:20 +02:00
parent 913614a284
commit 31ab4ec79e
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 13 additions and 7 deletions

View File

@ -61,7 +61,7 @@ p.catch(err => {
translations,
availableLanguages,
defaultLanguage: 'en_US',
silent: process.env.NODE_ENV === 'production'
silent: true
})
Vue.config.language = currentLanguage

View File

@ -155,7 +155,7 @@
</div>
<div class="button-block">
<input class="peertube-button" type="button" v-bind:value="applyFiltersLabel" v-on:click="scrollToResults(); doNewSearch()" />
<input class="peertube-button" type="button" v-bind:value="applyFiltersLabel" v-on:click="doNewSearch()" />
</div>
</form>
@ -445,14 +445,21 @@
this.indexName = config.searchInstanceName
this.loadUrl()
this.doSearch()
},
watch: {
// For pagination change
$route(to, from) {
if (!this.searchDone) return
this.loadUrl()
this.doSearch()
const urlPage = this.$route.query.page
if (urlPage && parseInt(urlPage) !== this.currentPage) {
this.loadUrl()
this.doSearch(false)
this.scrollToResults()
}
},
formSort () {
@ -638,7 +645,8 @@
licenceOneOf: this.formLicenceOneOf,
languageOneOf: this.formLanguageOneOf,
tagsAllOf: this.formTagsAllOf.map(t => t.text),
tagsOneOf: this.formTagsOneOf.map(t => t.text)
tagsOneOf: this.formTagsOneOf.map(t => t.text),
page: this.currentPage
}
this.$router.push({ path: '/search', query })
@ -662,8 +670,6 @@
if (query.page && this.currentPage !== query.page) {
this.currentPage = parseInt(query.page + '')
this.scrollToResults()
}
},