This commit is contained in:
parent
2abc46216d
commit
25be34d9c7
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"backend_de": "http://localhost:31204",
|
"backend_dev": "http://localhost:31204",
|
||||||
"backend_dev": "https://webplay.rocks",
|
"backend_de": "https://webplay.rocks",
|
||||||
"backend": "https://webplay.rocks"
|
"backend": "https://webplay.rocks"
|
||||||
}
|
}
|
@ -3,12 +3,18 @@ import axios from 'axios'
|
|||||||
export default {
|
export default {
|
||||||
checkIfInstanceIsNew(context) {
|
checkIfInstanceIsNew(context) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
axios.get(context.rootGetters.server + "/api/system/setup").then((res) => {
|
axios
|
||||||
|
.get(context.rootGetters.server + "/api/system/setup")
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res.status);
|
||||||
if (res.status == 200) {
|
if (res.status == 200) {
|
||||||
resolve(true);
|
resolve(true);
|
||||||
} else {
|
} else {
|
||||||
resolve(false);
|
resolve(false);
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log(err);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -10,11 +10,13 @@ export default {
|
|||||||
load(context) {
|
load(context) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios.get(context.rootGetters.server + "/api/user/login", context.rootGetters.headers).then((res) => {
|
axios.get(context.rootGetters.server + "/api/user/login", context.rootGetters.headers).then((res) => {
|
||||||
|
console.log(res.data);
|
||||||
context.commit("load", res.data);
|
context.commit("load", res.data);
|
||||||
context.rootState["player"].shuffle = res.data.player.shuffle;
|
context.rootState["player"].shuffle = res.data.player.shuffle;
|
||||||
context.rootState["player"].repeatType = res.data.player.repeat;
|
context.rootState["player"].repeatType = res.data.player.repeat;
|
||||||
resolve();
|
resolve();
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
console.log("error")
|
||||||
context.commit("resetToken");
|
context.commit("resetToken");
|
||||||
reject(err);
|
reject(err);
|
||||||
});
|
});
|
||||||
|
@ -123,13 +123,17 @@ export default {
|
|||||||
checkTocken() {
|
checkTocken() {
|
||||||
let token = localStorage.getItem("token");
|
let token = localStorage.getItem("token");
|
||||||
if (token) {
|
if (token) {
|
||||||
|
console.log("hello token")
|
||||||
this.$store.dispatch("user/setToken", token);
|
this.$store.dispatch("user/setToken", token);
|
||||||
|
console.log("hello token; user/load")
|
||||||
this.$store
|
this.$store
|
||||||
.dispatch("user/load")
|
.dispatch("user/load")
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
console.log("user loaded")
|
||||||
this.goto();
|
this.goto();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
console.log("user not loaded")
|
||||||
console.log(err);
|
console.log(err);
|
||||||
this.checkIfNewBackend();
|
this.checkIfNewBackend();
|
||||||
});
|
});
|
||||||
@ -157,6 +161,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
checkIfNewBackend() {
|
checkIfNewBackend() {
|
||||||
|
console.log("check new instance")
|
||||||
this.$store.dispatch("checkIfInstanceIsNew").then((res) => {
|
this.$store.dispatch("checkIfInstanceIsNew").then((res) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
this.$router.replace("setup");
|
this.$router.replace("setup");
|
||||||
|
Loading…
Reference in New Issue
Block a user