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 () {
|
getAPIUrl () {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
if(localStorage.getItem("apiURL")) {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
axios.get('/apiurl')
|
axios.get('/apiurl')
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
// handle success
|
// handle success
|
||||||
|
|
|
@ -71,12 +71,18 @@ export default new Vuex.Store({
|
||||||
actions: {
|
actions: {
|
||||||
getSettings: function (context) {
|
getSettings: function (context) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
if(localStorage.getItem("settings")) {
|
||||||
|
context.commit('setSettings', localStorage.getItem("settings"))
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
ServerService.getPublicSettings().then((res) => {
|
ServerService.getPublicSettings().then((res) => {
|
||||||
|
localStorage.setItem("settings", res.data.data)
|
||||||
context.commit('setSettings', res.data.data)
|
context.commit('setSettings', res.data.data)
|
||||||
resolve()
|
resolve()
|
||||||
}).catch((res) => {
|
}).catch((res) => {
|
||||||
context.commit('setError')
|
context.commit('setError')
|
||||||
});
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
checkAccount: function(context) {
|
checkAccount: function(context) {
|
||||||
|
|
Reference in a new issue