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

add page routing

parent 724295dd
No related branches found
No related tags found
No related merge requests found
......@@ -95,7 +95,7 @@ function navigate_to_article(self, source) {
})
.then(function(response){
self.waiting_for_articles = false
history.replaceState({article: self.article, search_results: [], lang: self.lang, error: self.error, pos_selected: self.pos_selected, scope: self.scope, article_info: self.article_info}, '')
history.replaceState({article: self.article, search_results: [], lang: self.lang, error: self.error, pos_selected: self.pos_selected, scope: self.scope, article_info: self.article_info, page: self.page}, '')
if (source) {
self.$plausible.trackEvent('internal link incoming', {props: {origin: source}})
}
......@@ -189,7 +189,8 @@ function navigate_to_query(self, word) {
pos_selected: self.pos_selected,
scope: self.scope,
article_info: self.article_info,
search_results: self.search_results
search_results: self.search_results,
page: self.page
}, '')
})
......@@ -317,7 +318,7 @@ export default {
article_link_click: function(item) {
if (this.article && this.article.article_id == item.article_id){
this.article_key++
history.replaceState({article: this.article, search_results: this.search_results, lang: this.lang, error: this.error, pos_selected: this.pos_selected, scope: this.scope, article_info: this.article_info}, '')
history.replaceState({article: this.article, search_results: this.search_results, lang: this.lang, error: this.error, pos_selected: this.pos_selected, scope: this.scope, article_info: this.article_info, page: this.page}, '')
}else{
navigate_to_article(this, item.source)
......@@ -326,7 +327,7 @@ export default {
details_click: function(item) {
item.article.source = this.previous
this.article = item.article
history.replaceState({article: this.article, search_results: [], lang: this.lang, error: null, pos_selected: this.pos_selected, scope: this.scope, article_info: this.article_info}, '')
history.replaceState({article: this.article, search_results: [], lang: this.lang, error: null, pos_selected: this.pos_selected, scope: this.scope, article_info: this.article_info, page: this.page}, '')
},
return_to_results: function() {
this.article = null
......@@ -346,6 +347,11 @@ export default {
if (self.$route.query.scope) {
self.scope = self.$route.query.scope
}
if (self.$route.query.page) {
self.page = self.$route.query.page
console.log(self.page)
}
Promise.all([
axios.get(ARTICLE_ENDPOINT + 'bm/concepts.json').then(function(response){
let concepts = response.data.concepts
......@@ -377,7 +383,8 @@ export default {
error: self.error,
pos_selected: self.pos_selected,
scope: self.scope,
article_info: self.article_info}, '')
article_info: self.article_info,
page: self.page}, '')
// words of the month
......@@ -409,6 +416,7 @@ export default {
self.pos_selected = event.pos_selected || self.pos_selected
self.scope = event.scope || self.scope
self.error = event.state.error
self.page = event.state.page
}
}
......
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