diff options
author | Sam Wilkins <abdullah_ahmed@brown.edu> | 2019-03-18 00:29:20 -0400 |
---|---|---|
committer | Sam Wilkins <abdullah_ahmed@brown.edu> | 2019-03-18 00:29:20 -0400 |
commit | 748412d972bd466a372fcf384448d3a00b42ee9f (patch) | |
tree | 465d5e001a100eab5fd6c46ab381034742018207 /src/server/authentication/models/user_utils.ts | |
parent | af5a3bca4caf2aadb5ce832c025e1c14b78a5728 (diff) |
implemented multi-client remote cursor
Diffstat (limited to 'src/server/authentication/models/user_utils.ts')
-rw-r--r-- | src/server/authentication/models/user_utils.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/server/authentication/models/user_utils.ts b/src/server/authentication/models/user_utils.ts new file mode 100644 index 000000000..1497a4ba4 --- /dev/null +++ b/src/server/authentication/models/user_utils.ts @@ -0,0 +1,22 @@ +import { DashUserModel } from "./user_model"; +import * as request from 'request' +import { RouteStore } from "../../RouteStore"; +import { ServerUtils } from "../../ServerUtil"; + +export class UserUtils { + private static current: string; + + public static get currentUserId() { + return UserUtils.current; + } + + public static loadCurrentUserId() { + request.get(ServerUtils.prepend(RouteStore.getCurrUser), (error, response, body) => { + if (body) { + UserUtils.current = JSON.parse(body) as string; + } else { + throw new Error("There should be a user! Why does Dash think there isn't one?") + } + }); + } +}
\ No newline at end of file |