mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
dont show ui before initial sync
This commit is contained in:
parent
8f09fdbc79
commit
818cf8051c
17
src/main.js
17
src/main.js
@ -54,14 +54,19 @@ export default async function main(label, button, container) {
|
|||||||
await session.setLoginData(loginData);
|
await session.setLoginData(loginData);
|
||||||
}
|
}
|
||||||
await session.load();
|
await session.load();
|
||||||
showSession(container, session);
|
const hsApi = new HomeServerApi(HOMESERVER, session.accessToken);
|
||||||
const hsApi = new HomeServerApi(HOMESERVER, session.accessToken);
|
console.log("session loaded");
|
||||||
console.log("session loaded");
|
const needsInitialSync = !session.syncToken;
|
||||||
if (!session.syncToken) {
|
if (needsInitialSync) {
|
||||||
console.log("session needs initial sync");
|
console.log("session needs initial sync");
|
||||||
}
|
} else {
|
||||||
|
showSession(container, session);
|
||||||
|
}
|
||||||
const sync = new Sync(hsApi, session, storage);
|
const sync = new Sync(hsApi, session, storage);
|
||||||
await sync.start();
|
await sync.start();
|
||||||
|
if (needsInitialSync) {
|
||||||
|
showSession(container, session);
|
||||||
|
}
|
||||||
label.innerText = "sync running";
|
label.innerText = "sync running";
|
||||||
button.addEventListener("click", () => sync.stop());
|
button.addEventListener("click", () => sync.stop());
|
||||||
sync.on("error", err => {
|
sync.on("error", err => {
|
||||||
|
Loading…
Reference in New Issue
Block a user