From ec8b0c51f872d2972a3deb6d6a836b9d9fd30141 Mon Sep 17 00:00:00 2001
From: schneefux <schneefux+commit@schneefux.xyz>
Date: Mon, 21 May 2018 15:55:52 +0200
Subject: Move query get/set into mixin

---
 src/Home.vue | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'src/Home.vue')

diff --git a/src/Home.vue b/src/Home.vue
index 69de621..b18a3d3 100644
--- a/src/Home.vue
+++ b/src/Home.vue
@@ -11,10 +11,12 @@
 <script>
 import Vue from 'vue';
 import ModeTab from './ModeTab.vue';
+import RouterParamMixin from './RouterParamMixin.js';
 import * as maps from './maps/maps';
 
 export default Vue.component('home', {
   props: [ 'reportService' ],
+  mixins: [ RouterParamMixin ],
   data: function() {
     return {
       modes: this.reportService.getModes(),
@@ -24,12 +26,11 @@ export default Vue.component('home', {
   computed: {
     tabIndex: {
       get: function() {
-        return this.reportService.getModes().indexOf(this.$route.query.mode);
+        return this.reportService.getModes().indexOf(this.selectedMode);
       },
       set: function(index) {
         const mode = this.reportService.getModes()[index];
-        const query = Object.assign({}, this.$route.query, { mode: mode });
-        this.$router.push({ query });
+        this.selectedMode = mode;
       },
     },
   },
-- 
cgit v1.3.1

