From 5577c561cbe4911315dcc5d5d25dbc07c32fbfde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Volds=C3=A6ter?= <ole.voldsater@uib.no> Date: Mon, 21 Sep 2020 15:42:48 +0200 Subject: [PATCH] refs meta#150 bruk nytt URL-skjema --- src/App.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/App.vue b/src/App.vue index 77e09361..2e7c1f05 100644 --- a/src/App.vue +++ b/src/App.vue @@ -57,7 +57,7 @@ import SearchResults from './components/SearchResults.vue' import Autocomplete from '@trevoreyre/autocomplete-vue' import '@trevoreyre/autocomplete-vue/dist/style.css' -var api_endpoint = 'https://beta.ordbok.uib.no/api/article' +var api_endpoint = 'https://beta.ordbok.uib.no/api/dict' axios.interceptors.request.use(function (config) { config.headers["x-api-key"] = "ZkYiyRVXxH86ijsvhx3cH4SY5Iik2ijI3BKVJGMm" @@ -90,7 +90,7 @@ export default { let self = this return function(q) { return new Promise(resolve => { - return axios.get(api_endpoint + '/' + self.lang + '/suggest?q=' + q).then( + return axios.get(api_endpoint + '/' + self.lang + '/article/suggest?q=' + q).then( function(response) { let hits = q.length ? [{q: q}] : [] hits = hits.concat(response.data.suggest.suggest[0].options.sort((o1, o2) => o1.text.length - o2.text.length)) @@ -119,7 +119,7 @@ export default { var self = this self.waiting = true self.article = {lemmas: [], body:{pronunciation: [], definitions: [], etymology: []}} - axios.get(api_endpoint + '/' + self.lang + '/search?q=' + event.q + ' ' + event.q + '*&size=20') + axios.get(api_endpoint + '/' + self.lang + '/article/search?q=' + event.q + ' ' + event.q + '*&size=20') .then(function(response){ self.$router.push('/' + `/search?q=${event.q}&lang=${self.lang}`) self.search_results = response.data.hits.hits @@ -136,7 +136,7 @@ export default { }else{ self.article = {lemmas: [], body:{pronunciation: [], definitions: [], etymology: []}} self.waiting = true - axios.get(api_endpoint + '/' + self.lang + '/' + item.article_id) + axios.get(api_endpoint + '/' + self.lang + '/article/' + item.article_id) .then(function(response){ self.article = response.data._source self.waiting = false @@ -154,7 +154,7 @@ export default { this.lang = this.$route.params.lang || this.$route.query.lang || 'bob,nob' var self = this; if(this.$route.query.q) { - axios.get(api_endpoint + '/' + self.lang + '/search?q=' + self.$route.query.q + ' ' + self.$route.query.q + '*&size=20') + axios.get(api_endpoint + '/' + self.lang + '/article/search?q=' + self.$route.query.q + ' ' + self.$route.query.q + '*&size=20') .then(function(response){ self.search_results = response.data.hits.hits self.waiting = false @@ -162,7 +162,7 @@ export default { }) } else if(this.$route.params.id){ - axios.get(api_endpoint + '/' + self.lang + '/' + self.$route.params.id) + axios.get(api_endpoint + '/' + self.lang + '/article/' + self.$route.params.id) .then(function(response){ self.article = response.data._source self.waiting = false -- GitLab