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, translations,
availableLanguages, availableLanguages,
defaultLanguage: 'en_US', defaultLanguage: 'en_US',
silent: process.env.NODE_ENV === 'production' silent: true
}) })
Vue.config.language = currentLanguage Vue.config.language = currentLanguage

View File

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