From dd6c727f9d7836d2d86a9a1e7026eb694eaba500 Mon Sep 17 00:00:00 2001 From: Sam Wilkins Date: Wed, 27 Feb 2019 12:53:49 -0500 Subject: slight loading refactor --- src/client/views/Main.tsx | 12 +++++++++--- src/server/authentication/controllers/WorkspacesMenu.tsx | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx index 90ce8be1a..d4bfbb52a 100644 --- a/src/client/views/Main.tsx +++ b/src/client/views/Main.tsx @@ -40,10 +40,11 @@ document.addEventListener("pointerdown", action(function (e: PointerEvent) { let mainDocId: string; request.get(window.location.origin + "/getActiveWorkspaceId", (error, response, body) => { const here = window.location.origin; + let workspaceId: string; if (body) { - mainDocId = body; + workspaceId = body; } else { - mainDocId = Utils.GenerateGuid(); + workspaceId = Utils.GenerateGuid(); request.post(here + "/addWorkspaceId", { body: { target: mainDocId @@ -57,9 +58,14 @@ request.get(window.location.origin + "/getActiveWorkspaceId", (error, response, json: true }) } - init(); + load(workspaceId); }) +function load(workspaceId: string) { + mainDocId = workspaceId; + init(); +} + //runInAction(() => // let doc1 = Documents.TextDocument({ title: "hello" }); // let doc2 = doc1.MakeDelegate(); diff --git a/src/server/authentication/controllers/WorkspacesMenu.tsx b/src/server/authentication/controllers/WorkspacesMenu.tsx index a440ab779..b1125384e 100644 --- a/src/server/authentication/controllers/WorkspacesMenu.tsx +++ b/src/server/authentication/controllers/WorkspacesMenu.tsx @@ -39,6 +39,7 @@ export class WorkspacesMenu extends React.Component { } setWorkspaceId = (e: React.MouseEvent) => { + //Main.load(e.currentTarget.innherHTML) console.log(e.currentTarget.innerHTML); } -- cgit v1.2.3-70-g09d2