Settings and api preload
This commit is contained in:
parent
97be00a3b6
commit
f7bd710fc0
2 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
Reference in a new issue