Configurable api base url.

This commit is contained in:
aminecmi 2022-07-17 16:17:08 +02:00
parent 90f3a2366a
commit b1b19ba71a
5 changed files with 11 additions and 8 deletions

3
.gitignore vendored
View File

@ -283,3 +283,6 @@ modules.xml
package-lock.json
.env.production

View File

@ -32,7 +32,7 @@ export default {
this.$emit('toggleModal')
},
createItem: function () {
fetch('http://localhost:7000/api/lists', {
fetch(`${process.env.VUE_APP_API_BASE_URL}/api/lists`, {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=utf-8',
@ -47,7 +47,7 @@ export default {
})
},
updateItem: function () {
fetch('http://localhost:7000/api/lists/' + this.item.id, {
fetch(`${process.env.VUE_APP_API_BASE_URL}/api/lists/` + this.item.id, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json;charset=utf-8',

View File

@ -66,7 +66,7 @@ export default {
if (!ignoreLoading) {
this.loading = true;
}
fetch('http://localhost:7000/api/lists/' + this.listId + '/items', {
fetch(`${process.env.VUE_APP_API_BASE_URL}/api/lists/' + this.listId + '/items`, {
method: 'GET',
headers: {
'Content-Type': 'application/json;charset=utf-8',
@ -86,7 +86,7 @@ export default {
item.loading = true;
const itemCopy = Object.assign({}, item);
delete itemCopy.loading;
fetch('http://localhost:7000/api/lists/' + this.listId + '/items/' + item.id, {
fetch(`${process.env.VUE_APP_API_BASE_URL}/api/lists/' + this.listId + '/items/` + item.id, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json;charset=utf-8',
@ -132,7 +132,7 @@ export default {
};
this.updateItem(itemToSend, true);
} else {
fetch('http://localhost:7000/api/lists/' + this.listId + '/items', {
fetch(`${process.env.VUE_APP_API_BASE_URL}/api/lists/' + this.listId + '/items`, {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=utf-8',

View File

@ -52,7 +52,7 @@ export default {
},
methods: {
fetchLists: function () {
fetch('http://localhost:7000/api/lists', {
fetch(`${process.env.VUE_APP_API_BASE_URL}/api/lists`, {
method: 'GET',
headers: {
'Content-Type': 'application/json;charset=utf-8',
@ -65,7 +65,7 @@ export default {
})
},
deleteItem: function (item) {
fetch('http://localhost:7000/api/lists/' + item.id, {
fetch(`${process.env.VUE_APP_API_BASE_URL}/api/lists/` + item.id, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json;charset=utf-8',

View File

@ -23,7 +23,7 @@ export default {
},
methods: {
sendKey: function () {
fetch('http://localhost:7000/api/keys:check', {
fetch(`${process.env.VUE_APP_API_BASE_URL}/api/keys:check`, {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=utf-8'