Settings and api preload

This commit is contained in:
Kekskurse 2019-12-02 17:14:49 +01:00
parent 97be00a3b6
commit f7bd710fc0
2 changed files with 9 additions and 0 deletions

View File

@ -13,6 +13,9 @@ export default {
},
getAPIUrl () {
return new Promise((resolve, reject) => {
if(localStorage.getItem("apiURL")) {
resolve();
}
axios.get('/apiurl')
.then(function (response) {
// handle success

View File

@ -71,12 +71,18 @@ export default new Vuex.Store({
actions: {
getSettings: function (context) {
return new Promise((resolve, reject) => {
if(localStorage.getItem("settings")) {
context.commit('setSettings', localStorage.getItem("settings"))
resolve();
}
ServerService.getPublicSettings().then((res) => {
localStorage.setItem("settings", res.data.data)
context.commit('setSettings', res.data.data)
resolve()
}).catch((res) => {
context.commit('setError')
});
})
},
checkAccount: function(context) {