diff --git a/src/App.vue b/src/App.vue index dcff51aa986526367b705fd0d85d649f47fc10ef..d58d716f28099ceb3f724a605f8bc7711bac2432 100644 --- a/src/App.vue +++ b/src/App.vue @@ -130,14 +130,13 @@ export default { search_results: [], lang: 'bob,nob', waiting_for_articles: true, - waiting_for_bob_metadata: true, - waiting_for_nob_metadata: true, + waiting_for_metadata: true, article: {lemmas: [], body:{pronunciation: [], definitions: [], etymology: []}} } }, computed: { waiting: function() { - return this.waiting_for_articles || this.waiting_for_bob_metadata || this.waiting_for_nob_metadata + return this.waiting_for_articles || this.waiting_for_metadata }, api_pref: function() { return api_endpoint + '/' + this.lang + '/article/' @@ -203,30 +202,30 @@ export default { }, mounted: function(){ let self = this - axios.get(api_endpoint + '/bob').then(function(response){ - let concepts = response.data.concepts - entities.bob = concepts - self.waiting_for_bob_metadata = false - }) - - axios.get(api_endpoint + '/nob').then(function(response){ - let concepts = response.data.concepts - entities.nob = concepts - self.waiting_for_nob_metadata = false - }) - this.lang = 'bob,nob' - if(this.$route.name == 'word') { - navigate_to_word(this, this.$route.params.word) - } - else if(this.$route.name == 'lookup'){ - navigate_to_article(this, this.$route.params.id) - } - else { - this.waiting_for_articles = false - history.replaceState({article: this.article, search_results: this.search_results, lang: this.lang}, '') - } + Promise.all([ + axios.get(api_endpoint + '/bob').then(function(response){ + let concepts = response.data.concepts + entities.bob = concepts + }), + axios.get(api_endpoint + '/nob').then(function(response){ + let concepts = response.data.concepts + entities.nob = concepts + }) + ]).then(function(_) { + self.waiting_for_metadata = false + if(self.$route.name == 'word') { + navigate_to_word(self, self.$route.params.word) + } + else if(self.$route.name == 'lookup'){ + navigate_to_article(self, self.$route.params.id) + } + else { + self.waiting_for_articles = false + history.replaceState({article: self.article, search_results: self.search_results, lang: self.lang}, '') + } + }) } } </script>