diff --git a/src/components/DictionaryView.vue b/src/components/DictionaryView.vue index f334bd04dbe9e633a480f93d07fce5174a4976a0..ee46a0a595ee682665c9c4407ff7a1ecf730c7b7 100644 --- a/src/components/DictionaryView.vue +++ b/src/components/DictionaryView.vue @@ -128,6 +128,7 @@ function navigate_to_article(self, origin) { const lang = self.$route.params.lang axios.get(ARTICLE_ENDPOINT + lang + '/article/' + self.$route.params.id + ".json") + //axios.get('https://httpstat.us/502') .then(function(response){ self.article = Object.assign(response.data, {'dictionary': lang, results: self.search_results}) self.error = null @@ -162,6 +163,7 @@ function load_articles(self, query, offset, n, dict) { return Promise.all(article_IDs.map((article_id) => { return axios.get(`${ARTICLE_ENDPOINT}${dict}/article/${article_id}.json`) + //return axios.get('https://httpstat.us/502') })) .then((response) => { @@ -200,6 +202,7 @@ function navigate_to_query(self, word) { if (!/[_*%|]/.test(q)) { let params = {q, dict: self.lang, dform: 'int', include: "i", meta: 'n', wc: self.pos_selected} api.get('suggest?', {params}) + //axios.get('https://httpstat.us/502') .then((response) => { self.inflection_suggestions = response.data.a.inflect }).catch(error =>{ @@ -215,7 +218,8 @@ function navigate_to_query(self, word) { offset = self.perPage * (self.page -1) } if (self.pos_selected) params.wc = self.pos_selected - api.get('articles?', {params}).then((response) => { + api.get('articles?', {params}).then((response) => { + //axios.get('https://httpstat.us/502').then((response) => { self.article_info = response.data self.search_results = {} @@ -232,21 +236,27 @@ function navigate_to_query(self, word) { } let params = {q, dict, dform: 'int', include: "s", wc: self.pos_selected} api.get('suggest?', {params}) + //axios.get('https://httpstat.us/502') .then((response) => { self.similar = response.data.a.similar - self.replace_history() + self.replace_history() + }).catch(error => { + self.handle_error(error) + self.replace_history() }) } } if (total_length == 0) { + console.log(bm_length, nn_length) + console.log(response) self.waiting_for_articles = false self.no_results = true self.replace_history() // fixes routing bug when going back from suggested search } else { - self.no_results = null + self.no_results = false Promise.all([ load_articles(self, query, offset, self.perPage, "bm"), load_articles(self, query, offset, self.perPage, "nn") @@ -349,11 +359,7 @@ export default { this.waiting_for_articles = false this.no_results = false this.search_results = {} - console.log(error) - if (error.message == "Network Error") { - this.error = {title: this.$t('error.network.title'), description: this.$t('error.network.description'), article} - } - else if (error.response) { + if (error.response) { if (error.response.status == 404) { if (article) { this.error = {title: this.$t('error.404.title'), description: this.$t('error.no_article', {id: this.$route.params.id}), article: true} @@ -371,7 +377,10 @@ export default { else { this.error = {title: this.$t('error.generic_code.title'), description: this.$t('error.generic_code.description', {code: error.response.status}), article} } - } else { + } else if (error.message == "Network Error") { + this.error = {title: this.$t('error.network.title'), description: this.$t('error.network.description'), article} + } + else { this.error = {title: this.$t('error.generic.title'), description: this.$t('error.generic.description'), article} } },