From 3ecda17a0d3970fdf777ae92f0bf480e4969ee61 Mon Sep 17 00:00:00 2001
From: Petr Kalashnikov <pka065@it6100016.klientdrift.uib.no>
Date: Fri, 9 Jul 2021 15:57:05 +0200
Subject: [PATCH] Fix search-option in url

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

diff --git a/src/components/DictionaryView.vue b/src/components/DictionaryView.vue
index 4bfad830..a4509ad4 100644
--- a/src/components/DictionaryView.vue
+++ b/src/components/DictionaryView.vue
@@ -2,7 +2,7 @@
   <main>
     <div class="search_container">
       <div class="lang_select_container">
-        <v-radio-group row v-model="lang" @change="force_rerender">
+        <v-radio-group row v-model="lang" @change="update_lang_form">
           <template v-slot:label>
             <span>VIS</span>
           </template>
@@ -201,7 +201,6 @@ export default {
       if(event.articles){
         let source = '/' + this.lang + '/w/' + event.word
         this.$router.push(source)
-        console.log(this.$router)
         this.search_results = event.articles.sort(compare_by_hgno(decodeURIComponent(event.word))).map(a => Object.assign(a, {source: source}))
         this.article = null
         this.error = null
@@ -215,13 +214,13 @@ export default {
         this.$plausible.trackEvent('dropdown selection', {props: {query: event.label, match: '<fritekstsøk>'}})
       }
     },
-    force_rerender: function(event) {
+    update_lang_form: function(event) {
       if (this.event){
         this.event.articles = null
         this.select_result(this.event)
       }
       else{
-        navigate_to_search(this, this.$router.history.current.params.word)
+        navigate_to_search(this, this.$router.history.current.params.word || this.$router.history.current.params.query)
       }
     },
     article_link_click: function(item) {
-- 
GitLab