diff --git a/src/services/Server.js b/src/services/Server.js index 623d0965..5a3aa6be 100644 --- a/src/services/Server.js +++ b/src/services/Server.js @@ -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 diff --git a/src/store/store.js b/src/store/store.js index c5e960ba..483a5ce2 100644 --- a/src/store/store.js +++ b/src/store/store.js @@ -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) {