Skip to content
Snippets Groups Projects
Commit 8c96d382 authored by Henrik Askjer's avatar Henrik Askjer
Browse files

return to results after clicking multiple links

parent 3b9b1898
No related branches found
No related tags found
No related merge requests found
......@@ -12,10 +12,10 @@
</div>
<div class="return_to_results" v-if="total_results && article">
<router-link v-if="article.source" :to="article.source" @click.native="return_to_results()">
<router-link v-if="previous" :to="previous" @click.native="return_to_results()">
<v-icon left class="nav_arrow">chevron_left</v-icon>{{$t("back_to_results")}}
</router-link>
<a v-if="!article.source" href="/">
<a v-if="!this.previous" href="/">
<v-icon left class="nav_arrow">chevron_left</v-icon>Søk etter andre ord
</a>
</div>
......@@ -99,7 +99,6 @@ function navigate_to_article(self, source) {
axios.get(ARTICLE_ENDPOINT + lang + '/article/' + self.$route.params.id + ".json")
.then(function(response){
self.article = Object.assign(response.data, {'dictionary': lang, results: self.search_results})
self.search_results = {}
self.error = null
})
.catch(function(error){
......@@ -219,6 +218,7 @@ function navigate_to_query(self, word) {
self.inflection_suggestions = []
}
self.waiting_for_articles = false
history.replaceState({
article: self.article,
lang: self.lang,
......@@ -230,6 +230,7 @@ function navigate_to_query(self, word) {
page: self.page,
perPage: self.perPage
}, '')
self.previous = self.$route.fullPath
})
}).catch(error =>{
......@@ -440,7 +441,8 @@ export default {
}
},
details_click: function(item) {
item.article.source = this.previous.split('#')[0] + "#" + item.title_id
item.article.source = this.$route.fullPath
this.previous = this.previous.split('#')[0] + "#" + item.title_id
this.article = item.article
history.replaceState({article: this.article,
search_results: {},
......@@ -458,11 +460,6 @@ export default {
this.article = null
}
},
watch: {
$route(to, from) {
this.previous = from.fullPath
}
},
mounted: function(){
let self = this
self.lang = self.$route.params.lang || this.$store.state.defaultDict
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment