Merge pull request #122 from lbbniu/master_login_bug

pull/125/head
QLeelulu 2018-11-29 16:43:29 +08:00 committed by GitHub
commit 142b5adad5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -46,14 +46,16 @@ var restApi = new Rest('/v1/', (msg) => {
bus.$emit('goLogin')
}
});
var loadNodes = function() {
var loadNodes = function(resolve) {
restApi.GET('nodes').onsucceed(200, (resp) => {
var nodes = {};
for (var i in resp) {
nodes[resp[i].id] = resp[i];
}
store.commit('setNodes', nodes);
resolve();
if(typeof resolve == "function"){
resolve();
}
}).do();
}
@ -145,7 +147,7 @@ var initConf = new Promise((resolve) => {
restApi.GET('configurations').onsucceed(200, (resp) => {
Vue.use((Vue) => Vue.prototype.$appConfig = resp);
bus.$emit('conf_loaded', resp);
loadNodes();
loadNodes(resolve);
setInterval(loadNodes, 60*1000);
}).onfailed((data, xhr) => {