diff options
Diffstat (limited to 'src/client/views/Main.tsx')
| -rw-r--r-- | src/client/views/Main.tsx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx index 5a0fb23bd..2f4264ad9 100644 --- a/src/client/views/Main.tsx +++ b/src/client/views/Main.tsx @@ -49,19 +49,14 @@ export class Main extends React.Component { initAuthenticationRouters = () => { // Load the user's active workspace, or create a new one if initial session after signup - request.get(window.location.origin + "/getActiveWorkspaceId", (error, response, body) => { + request.get(this.contextualize("getActiveWorkspaceId"), (error, response, body) => { this.requestWorkspace(body ? body : this.getNewWorkspace()); }); } getNewWorkspace = (): string => { let newId = Utils.GenerateGuid(); - const here = window.location.origin; - request.post(here + "/addWorkspaceId", { - body: { target: newId }, - json: true - }) - request.post(here + "/setActiveWorkspaceId", { + request.post(this.contextualize("addWorkspaceId"), { body: { target: newId }, json: true }) @@ -70,6 +65,10 @@ export class Main extends React.Component { @action requestWorkspace = (activeWorkspaceId: string) => { + request.post(this.contextualize("setActiveWorkspaceId"), { + body: { target: activeWorkspaceId }, + json: true + }) Documents.initProtos(activeWorkspaceId, this.prepareWorkspace); } @@ -99,6 +98,8 @@ export class Main extends React.Component { } } + contextualize = (extension: string) => window.location.origin + "/" + extension; + render() { let imgRef = React.createRef<HTMLDivElement>(); let webRef = React.createRef<HTMLDivElement>(); |
