api access refactored

This commit is contained in:
2020-07-14 22:27:13 +02:00
parent 5052e2b60e
commit 7cd3802bf7
13 changed files with 17 additions and 16 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ import axios from 'axios'
// let path = 'http://' + window.location.hostname + (window.env === 'prod' ? '/api' : ':8984')
export const REST = axios.create({
baseURL: 'http://' + window.location.hostname + (window.env === 'prod' ? '/api' : ':8984'),
baseURL: 'http://' + window.location.hostname,
// withCredentials: true,
crossorigin: true,
headers: {
+2 -1
View File
@@ -30,7 +30,8 @@ Vue.use(InfiniteLoading, {
Vue.use(VueScrollTo)
window.env = process.env
// window.env = process.env
window.apipath = process.env === 'prod' ? '/api' : ':8984'
// sync(store, router) // done. Returns an unsync callback fn
+1 -1
View File
@@ -21,7 +21,7 @@ export default {
}),
beforeCreate () {
// ?_format=json
REST.get(`/bibliography/works`, {})
REST.get(`${apipath}/bibliography/works`, {})
.then(({ data }) => {
console.log('Biblio REST: data', data)
// if(data.length){
+3 -3
View File
@@ -126,7 +126,7 @@ export default {
console.log('texts this.$route', this.$route)
// http://localhost:8984/texts/gdpSauval1724/toc
// get the edition's toc
REST.get(`/texts/` + this.$route.params.id + `/toc`, {})
REST.get(`${apipath}/texts/` + this.$route.params.id + `/toc`, {})
.then(({ data }) => {
console.log('texts/toc REST: data', data)
this.meta = data.meta
@@ -194,7 +194,7 @@ export default {
}),
getTextContent (textid, $state = null, direction = 'next') {
console.log('getTextContent', textid)
REST.get(`/items/${textid}`, {})
REST.get(`${apipath}/items/${textid}`, {})
.then(({ data }) => {
console.log('text REST: data', data)
if (direction === 'next') {
@@ -248,7 +248,7 @@ export default {
},
getIndexItem (item) {
this.indexitem = 'loading'
REST.get(`/index${item.index.charAt(0).toUpperCase()}${item.index.slice(1)}/${item.uuid}`, {})
REST.get(`${apipath}/index${item.index.charAt(0).toUpperCase()}${item.index.slice(1)}/${item.uuid}`, {})
.then(({ data }) => {
console.log('index tooltip REST: data', data)
if (this.indexitem === 'loading') {
+1 -1
View File
@@ -34,7 +34,7 @@ export default {
items: []
}),
beforeCreate () {
REST.get(`/indexLocorum`, {})
REST.get(`${apipath}/indexLocorum`, {})
.then(({ data }) => {
console.log('index locorum REST: data', data)
if (data.content.length) {
+1 -1
View File
@@ -37,7 +37,7 @@ export default {
beforeCreate () {
// items/gdpLeMaire1685T01BodyFr01.003.016
// texts/gdpSauval1724
REST.get(`/indexNominum`, {})
REST.get(`${apipath}/indexNominum`, {})
.then(({ data }) => {
console.log('index nominum REST: data', data)
if (data.content.length) {
+1 -1
View File
@@ -34,7 +34,7 @@ export default {
items: []
}),
beforeCreate () {
REST.get(`/indexOperum`, {})
REST.get(`${apipath}/indexOperum`, {})
.then(({ data }) => {
console.log('index operum REST: data', data)
if (data.content.length) {
+1 -1
View File
@@ -49,7 +49,7 @@ export default {
methods: {
loadItem () {
this.loaded = false
REST.get(`/items/` + this.uuid, {})
REST.get(`${apipath}/items/` + this.uuid, {})
.then(({ data }) => {
console.log('item REST: data', data)
this.item = data.content
+1 -1
View File
@@ -41,7 +41,7 @@ export default {
},
beforeCreate () {
console.log('locorum this.$route', this.$route)
REST.get(`/indexLocorum/` + this.$route.params.id, {})
REST.get(`${apipath}/indexLocorum/` + this.$route.params.id, {})
.then(({ data }) => {
console.log('locorum REST: data', data)
if (data.content) {
+1 -1
View File
@@ -40,7 +40,7 @@ export default {
},
beforeCreate () {
console.log('nominum this.$route', this.$route)
REST.get(`/indexNominum/` + this.$route.params.id, {})
REST.get(`${apipath}/indexNominum/` + this.$route.params.id, {})
.then(({ data }) => {
console.log('nominum REST: data', data)
if (data.content) {
+1 -1
View File
@@ -36,7 +36,7 @@ export default {
},
beforeCreate () {
console.log('operum this.$route', this.$route)
REST.get(`/indexOperum/` + this.$route.params.id, {})
REST.get(`${apipath}/indexOperum/` + this.$route.params.id, {})
.then(({ data }) => {
console.log('operum REST: data', data)
if (data.content) {
+2 -2
View File
@@ -57,7 +57,7 @@ export default {
},
// get authors
getAuthors ({ dispatch, commit, state }) {
return REST.get(`/corpus`, {})
return REST.get(`${apipath}/corpus`, {})
// .then(({ data }) => {
// console.log('corpus getAuthors REST: data', data)
// commit('setAuthors', data.content)
@@ -70,7 +70,7 @@ export default {
// get editionslist
getEditionsList ({ dispatch, commit, state }, authors) {
return Promise.all(authors.map(function (author) {
return REST.get(`/corpus/` + author.uuid, {})
return REST.get(`${apipath}/corpus/` + author.uuid, {})
.then(({ data }) => {
console.log('corpus getEditionsList REST: author, data', author, data)
// work arround
+1 -1
View File
@@ -41,7 +41,7 @@ export default {
}
// console.log('Search getResults params', params);
let q = qs.stringify(params)
return REST.get(`/search?` + q)
return REST.get(`${apipath}/search?` + q)
.then(({ data }) => {
console.log('search REST: data', data)
commit('setIsloading', false)