From 818cf8051c7f0a2b3fef6b01edebd8374f51a9d1 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 27 Feb 2019 23:38:03 +0100 Subject: [PATCH] dont show ui before initial sync --- src/main.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main.js b/src/main.js index b5487ae0..7c165d73 100644 --- a/src/main.js +++ b/src/main.js @@ -54,14 +54,19 @@ export default async function main(label, button, container) { await session.setLoginData(loginData); } await session.load(); - showSession(container, session); - const hsApi = new HomeServerApi(HOMESERVER, session.accessToken); - console.log("session loaded"); - if (!session.syncToken) { - console.log("session needs initial sync"); - } + const hsApi = new HomeServerApi(HOMESERVER, session.accessToken); + console.log("session loaded"); + const needsInitialSync = !session.syncToken; + if (needsInitialSync) { + console.log("session needs initial sync"); + } else { + showSession(container, session); + } const sync = new Sync(hsApi, session, storage); await sync.start(); + if (needsInitialSync) { + showSession(container, session); + } label.innerText = "sync running"; button.addEventListener("click", () => sync.stop()); sync.on("error", err => {