diff --git a/src/components/DictionaryView.vue b/src/components/DictionaryView.vue index 2708dd7b1dfc1aca480afca30b75d66f3da5a147..aa01d8527f5e47445711a13f7d32de64a600b058 100644 --- a/src/components/DictionaryView.vue +++ b/src/components/DictionaryView.vue @@ -38,7 +38,7 @@ <Article :key="article_key" :article="article" @article-click="article_link_click" /> </div> - <div class="welcome" v-if="! (article || error || total_results() || waiting)"> + <div class="welcome" v-if="!(article || error || $route.name || waiting)"> <div class="monthly" :class="$vuetify.breakpoint.name"> <div> <Article :article="monthly_bm" @article-click="article_link_click" /> @@ -307,7 +307,18 @@ export default { return total } }, - + load_monthly_bm: function() { + let self = this + axios.get(ARTICLE_ENDPOINT + 'bm/article/5607.json').then(function(response){ + self.monthly_bm = Object.assign(response.data, {dictionary: 'bm'}) + }) + }, + load_monthly_nn: function() { + let self = this + axios.get(ARTICLE_ENDPOINT + 'nn/article/78569.json').then(function(response){ + self.monthly_nn = Object.assign(response.data, {dictionary: 'nn'}) + }) + }, error_message: function(error) { this.search_results = {} console.log(error) @@ -520,15 +531,8 @@ export default { selected: self.selected, inflection_suggestions: self.inflection_suggestions}, '') - - // words of the month - axios.get(ARTICLE_ENDPOINT + 'bm/article/5607.json').then(function(response){ - self.monthly_bm = Object.assign(response.data, {dictionary: 'bm'}) - }) - - axios.get(ARTICLE_ENDPOINT + 'nn/article/78569.json').then(function(response){ - self.monthly_nn = Object.assign(response.data, {dictionary: 'nn'}) - }) + self.load_monthly_bm() + self.load_monthly_nn() } }).catch(function(error){ @@ -539,7 +543,18 @@ export default { self.waiting_for_articles = false }) }, + watch: { + $route(to, from) { + console.log("TO", to) + console.log("FROM", from) + if (!to.name) { + this.load_monthly_bm() + this.load_monthly_nn() + } + } + }, created: function() { + console.log("CREATED") let self = this window.onpopstate = function (event) { if (event.state) {