Bläddra i källkod

Changing backend domain on development

If not production (npm run serve), connect to localhost instead.
Ecconia 7 år sedan
förälder
incheckning
d6152afcae
1 ändrade filer med 7 tillägg och 2 borttagningar
  1. 7 2
      src/scripts/core.js

+ 7 - 2
src/scripts/core.js

@@ -3,6 +3,11 @@ import axios from "axios";
 export default class {
 	constructor(vuex) {
 		this.vuex = vuex
+		if(process.env.NODE_ENV !== 'production') {
+			this.api = 'http://localhost:8081'
+		} else {
+			this.api = 'https://live.ecconia.de'
+		}
 	}
 
 	commit(method, data)
@@ -13,7 +18,7 @@ export default class {
 	post(path, data)
 	{
 		return axios
-				.post('https://live.ecconia.de' + path, data)
+				.post(this.api + path, data)
 				.catch((error) => {
 					console.error('Error: ', error)
 				})
@@ -22,7 +27,7 @@ export default class {
 	get(path)
 	{
 		return axios
-				.get('https://live.ecconia.de' + path)
+				.get(this.api + path)
 				.catch((error) => {
 					console.error('Error: ', error)
 				})