From 53711c8800ff843f30f7dddfd52d70ffc55da9b5 Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Thu, 23 Jan 2020 17:04:41 +0800 Subject: [PATCH] refactor: merge update route code --- komga-webui/src/views/BrowseSeries.vue | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/komga-webui/src/views/BrowseSeries.vue b/komga-webui/src/views/BrowseSeries.vue index d15fe9c5c..b1a589b4d 100644 --- a/komga-webui/src/views/BrowseSeries.vue +++ b/komga-webui/src/views/BrowseSeries.vue @@ -137,11 +137,7 @@ export default Vue.extend({ }, watch: { sortActive () { - this.$router.replace({ - name: this.$route.name, - params: { seriesId: this.$route.params.seriesId, index: this.$route.params.index }, - query: { sort: `${this.sortActive.key},${this.sortActive.order}` } - }) + this.updateRoute() this.reloadData(this.seriesId) } }, @@ -212,13 +208,18 @@ export default Vue.extend({ const index = (max === undefined ? 0 : max).toString() if (this.$route.params.index !== index) { - this.$router.replace({ - name: this.$route.name, - params: { seriesId: this.$route.params.seriesId, index: index }, - query: { sort: `${this.sortActive.key},${this.sortActive.order}` } - }) + this.updateRoute(index) } }, + updateRoute (index?: string) { + this.$router.replace({ + name: this.$route.name, + params: { seriesId: this.$route.params.seriesId, index: index || this.$route.params.index }, + query: { + sort: `${this.sortActive.key},${this.sortActive.order}` + } + }) + }, reloadData (seriesId: number) { this.totalElements = null this.pagesState = []