aboutsummaryrefslogtreecommitdiff
path: root/src/server/authentication/models/current_user_utils.ts
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-04-14 20:12:52 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-04-14 20:12:52 -0400
commit6414a703d504a16c9eed5ab22eeb9ab829443511 (patch)
tree23f1da010561ac717f41f4547e09a3a333492d6f /src/server/authentication/models/current_user_utils.ts
parent845057ef78f272faf488b5bbc2fe79d64fb64120 (diff)
fixed workspace menu
Diffstat (limited to 'src/server/authentication/models/current_user_utils.ts')
-rw-r--r--src/server/authentication/models/current_user_utils.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/server/authentication/models/current_user_utils.ts b/src/server/authentication/models/current_user_utils.ts
index 34454eda0..848728183 100644
--- a/src/server/authentication/models/current_user_utils.ts
+++ b/src/server/authentication/models/current_user_utils.ts
@@ -1,4 +1,4 @@
-import { computed, observable, action } from "mobx";
+import { computed, observable, action, runInAction } from "mobx";
import * as rp from 'request-promise';
import { Documents } from "../../../client/documents/Documents";
import { Attribute, AttributeGroup, Catalog, Schema } from "../../../client/northstar/model/idea/idea";
@@ -13,13 +13,13 @@ import { ServerUtils } from "../../ServerUtil";
export class CurrentUserUtils {
private static curr_email: string;
private static curr_id: string;
- private static user_document: Document;
+ @observable private static user_document: Document;
//TODO tfs: these should be temporary...
private static mainDocId: string | undefined;
public static get email() { return this.curr_email; }
public static get id() { return this.curr_id; }
- public static get UserDocument() { return this.user_document; }
+ @computed public static get UserDocument() { return this.user_document; }
public static get MainDocId() { return this.mainDocId; }
public static set MainDocId(id: string | undefined) { this.mainDocId = id; }
@@ -40,14 +40,14 @@ export class CurrentUserUtils {
throw new Error("There should be a user! Why does Dash think there isn't one?");
}
});
- let userDocPromise = rp.get(ServerUtils.prepend(RouteStore.getUserDocumentId)).then(id => {
+ let userDocPromise = rp.get(ServerUtils.prepend(RouteStore.getUserDocumentId)).then(id => runInAction(() => {
if (id) {
return Server.GetField(id).then(field =>
this.user_document = field instanceof Document ? field : this.createUserDocument(id));
} else {
throw new Error("There should be a user id! Why does Dash think there isn't one?");
}
- });
+ }));
return Promise.all([userPromise, userDocPromise]);
}