diff --git a/apps/client/src/setup.ts b/apps/client/src/setup.ts index 29fbd15c00..3b3a40c336 100644 --- a/apps/client/src/setup.ts +++ b/apps/client/src/setup.ts @@ -1,7 +1,9 @@ import "jquery"; -import utils from "./services/utils.js"; + import ko from "knockout"; +import utils from "./services/utils.js"; + // TriliumNextTODO: properly make use of below types // type SetupModelSetupType = "new-document" | "sync-from-desktop" | "sync-from-server" | ""; // type SetupModelStep = "sync-in-progress" | "setup-type" | "new-document-in-progress" | "sync-from-desktop"; @@ -74,9 +76,9 @@ class SetupModel { // not using server.js because it loads too many dependencies const resp = await $.post("api/setup/sync-from-server", { - syncServerHost: syncServerHost, - syncProxy: syncProxy, - password: password + syncServerHost, + syncProxy, + password }); if (resp.result === "success") { @@ -123,6 +125,8 @@ function getSyncInProgress() { } addEventListener("DOMContentLoaded", (event) => { - ko.applyBindings(new SetupModel(getSyncInProgress()), document.getElementById("setup-dialog")); + const rootNode = document.getElementById("setup-dialog"); + if (!rootNode) return; + ko.applyBindings(new SetupModel(getSyncInProgress()), rootNode); $("#setup-dialog").show(); });