From 08c18b8c94182c87749b22dfd60d163150c213de Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 23 Oct 2018 13:03:36 -0600 Subject: [PATCH] async transitions, but don't delay --- lib/admin/js/app.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/admin/js/app.js b/lib/admin/js/app.js index 2dbedf2..9add25b 100644 --- a/lib/admin/js/app.js +++ b/lib/admin/js/app.js @@ -260,9 +260,8 @@ var appStates = { appData.views.section = { otp: true }; } , status: function () { - appData.views.section = { status: true }; - var tok = setInterval(function () { - api.status().then(function (status) { + function updateStatus() { + return api.status().then(function (status) { var wilddomains = []; var rootdomains = []; var subdomains = []; @@ -294,11 +293,15 @@ var appStates = { appData.newHttp.name = (appData.status.wildDomains[0] || {}).name; appData.state.ssh = (appData.status.ssh > 0) && appData.status.ssh || undefined; }); - }, 2000); + } + var tok = setInterval(updateStatus, 2000); - return function cancelState() { - clearInterval(tok); - }; + return updateStatus().then(function () { + appData.views.section = { status: true }; + return function cancelState() { + clearInterval(tok); + }; + }); } };