diff --git a/public/config.json b/public/config.json index a3b7d4a..f966bb7 100644 --- a/public/config.json +++ b/public/config.json @@ -1,5 +1,5 @@ { - "backend_de": "http://localhost:31204", - "backend_dev": "https://webplay.rocks", + "backend_dev": "http://localhost:31204", + "backend_de": "https://webplay.rocks", "backend": "https://webplay.rocks" } \ No newline at end of file diff --git a/src/store/actions.js b/src/store/actions.js index e1a2998..823b09f 100644 --- a/src/store/actions.js +++ b/src/store/actions.js @@ -3,13 +3,19 @@ import axios from 'axios' export default { checkIfInstanceIsNew(context) { return new Promise((resolve) => { - axios.get(context.rootGetters.server + "/api/system/setup").then((res) => { - if (res.status == 200) { - resolve(true); - } else { - resolve(false); - } - }); + axios + .get(context.rootGetters.server + "/api/system/setup") + .then((res) => { + console.log(res.status); + if (res.status == 200) { + resolve(true); + } else { + resolve(false); + } + }) + .catch(err => { + console.log(err); + }); }); }, loadClientConfigs(context) { diff --git a/src/store/modules/user/actions.js b/src/store/modules/user/actions.js index 0381491..74a49ab 100644 --- a/src/store/modules/user/actions.js +++ b/src/store/modules/user/actions.js @@ -10,11 +10,13 @@ export default { load(context) { return new Promise((resolve, reject) => { axios.get(context.rootGetters.server + "/api/user/login", context.rootGetters.headers).then((res) => { + console.log(res.data); context.commit("load", res.data); context.rootState["player"].shuffle = res.data.player.shuffle; context.rootState["player"].repeatType = res.data.player.repeat; resolve(); }).catch(err => { + console.log("error") context.commit("resetToken"); reject(err); }); diff --git a/src/views/Login.vue b/src/views/Login.vue index a649214..0f92088 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -123,13 +123,17 @@ export default { checkTocken() { let token = localStorage.getItem("token"); if (token) { + console.log("hello token") this.$store.dispatch("user/setToken", token); + console.log("hello token; user/load") this.$store .dispatch("user/load") .then(() => { + console.log("user loaded") this.goto(); }) .catch((err) => { + console.log("user not loaded") console.log(err); this.checkIfNewBackend(); }); @@ -157,6 +161,7 @@ export default { }); }, checkIfNewBackend() { + console.log("check new instance") this.$store.dispatch("checkIfInstanceIsNew").then((res) => { if (res) { this.$router.replace("setup");