Skip to content
Snippets Groups Projects
Commit 063b805a authored by Henrik Askjer's avatar Henrik Askjer
Browse files

Use api_pref and make api-key for old api a local argument in axios.get

parent 4e43d1ab
No related branches found
No related tags found
No related merge requests found
......@@ -99,6 +99,7 @@ function compare_by_hgno(lemma_text) {
}
}
/*
axios.interceptors.request.use(function (config) {
if (!config.url) {
config.headers["x-api-key"] = "ZkYiyRVXxH86ijsvhx3cH4SY5Iik2ijI3BKVJGMm"
......@@ -107,7 +108,7 @@ axios.interceptors.request.use(function (config) {
return config;
}, function (error) {
return Promise.reject(error);
});
});*/
function navigate_to_article(self, source) {
let config = {headers: {}}
......@@ -137,7 +138,7 @@ function navigate_to_article(self, source) {
}
function navigate_to_search(self, query) {
axios.get(self.api_old + 'search?q=' + query)
axios.get(self.api_pref + 'search?q=' + query, { headers: {"x-api-key":"ZkYiyRVXxH86ijsvhx3cH4SY5Iik2ijI3BKVJGMm"}}) // API-key to be removed or reimplemented with a ci-variable with the new API
.then(function(response){
self.search_results = response.data
if (! self.search_results.length) {
......@@ -162,7 +163,7 @@ function navigate_to_search(self, query) {
}
function navigate_to_word(self, word) {
axios.get(self.api_old + 'suggest?q=' + word)
axios.get(self.api_pref + 'suggest?q=' + word, { headers: {"x-api-key":"ZkYiyRVXxH86ijsvhx3cH4SY5Iik2ijI3BKVJGMm"}}) // API-key to be removed or reimplemented with a ci-variable with the new API
.then(function(response){
self.search_results = response.data.filter(result => result.match == word).sort(compare_by_hgno(word))
if (! self.search_results.length) {
......@@ -205,9 +206,6 @@ export default {
return (this.waiting_for_articles || this.waiting_for_metadata) && this.$route.name != 'root'
},
api_pref: function() {
return oda_dev + '/' + this.lang + '/article/'
},
api_old: function() {
return api_endpoint + '/' + this.lang + '/article/'
},
get_oda_api: function() {
......
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