From 163d892056e971da38f78b0229c897151548cd68 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ole=20Volds=C3=A6ter?= <ole.voldsater@uib.no>
Date: Mon, 9 Mar 2020 12:45:34 +0100
Subject: [PATCH] radioknapp for "begge" ny default, ser etter "lang" i query

---
 src/App.vue | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/App.vue b/src/App.vue
index 662b1b83..f38563b6 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -8,6 +8,8 @@
           </Preview>
         </template>
       </autocomplete>
+      <input type="radio" id="radio_both" value="nob,nno" v-model="lang">
+      <label for="radio_both">Begge</label>
       <input type="radio" id="radio_nob" value="nob" v-model="lang">
       <label for="radio_nob">Bokmål</label>
       <input type="radio" id="radio_nno" value="nno" v-model="lang">
@@ -123,7 +125,7 @@ export default {
     }
   },
   mounted: function(){
-    this.lang = this.$route.params.lang || 'nob'
+    this.lang = this.$route.params.lang || this.$route.query.lang || 'nob,nno'
     var self = this;
     if(this.$route.query.q) {
       axios.get(api_endpoint + '/' + self.lang + '/_search?q=' + self.$route.query.q + ' ' + self.$route.query.q + '*&sort=_score')
@@ -147,7 +149,7 @@ export default {
   },
   watch: {
     $route(to, from) {
-      this.lang = this.$route.params.lang || 'nob'
+      this.lang = this.$route.params.lang || this.$route.query.lang || 'nob,nno'
     }
   }
 }
-- 
GitLab