Skip to content
Snippets Groups Projects
Commit 5577c561 authored by Ole Voldsæter's avatar Ole Voldsæter
Browse files

refs meta#150 bruk nytt URL-skjema

parent ceb8829a
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment