diff --git a/src/App.vue b/src/App.vue index 04da2915f892197c45be00b6a1d38e760917f683..c73c49933b6353c17d16c6415f333fda9f8b0afe 100644 --- a/src/App.vue +++ b/src/App.vue @@ -135,9 +135,9 @@ export default { return new Promise(resolve => { return axios.get(self.api_pref + 'suggest?q=' + q).then( function(response) { - let hits = q.length ? [{q: q}] : [] + let hits = q.length ? [{}] : [] hits = hits.concat(response.data) - resolve(hits) + resolve(hits.map(h => Object.assign(h, {q: q}))) }) }) } @@ -154,10 +154,11 @@ export default { this.$refs.search.value = '' document.activeElement.blur() if(event.body){ - this.$router.push('/' + event.dictionary + '/' + event.article_id) + this.$router.push('/' + event.dictionary + '/' + event.article_id + '#' + event.match) this.search_results = [] this.article = event history.replaceState({article: this.article, search_results: this.search_results, lang: this.lang}, '') + this.$plausible.trackEvent('dropdown selection', {props: {query: event.q, dictionary: event.dictionary, match: event.match}}) }else{ this.waiting_for_articles = true this.article = {lemmas: [], body:{pronunciation: [], definitions: [], etymology: []}} @@ -182,7 +183,6 @@ export default { } }, mounted: function(){ - console.log(document.referrer) let self = this axios.get(api_endpoint + '/bob').then(function(response){ let concepts = response.data.concepts