summaryrefslogtreecommitdiffstats
path: root/ui/src/services
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-01-26 12:23:28 -0500
committerDessalines <tyhou13@gmx.com>2020-01-26 12:23:28 -0500
commit65adb0d15dcb10382dadca2694ee17b206c384fd (patch)
tree3fc7209c6a6b841e0e7caea09e32fa6077c73c75 /ui/src/services
parent29d34eaf03637fa5373a3accd5111600fd26b254 (diff)
Starting to work on websocket scopes.
Diffstat (limited to 'ui/src/services')
-rw-r--r--ui/src/services/UserService.ts1
-rw-r--r--ui/src/services/WebSocketService.ts8
2 files changed, 9 insertions, 0 deletions
diff --git a/ui/src/services/UserService.ts b/ui/src/services/UserService.ts
index 03380e59..0c3325a0 100644
--- a/ui/src/services/UserService.ts
+++ b/ui/src/services/UserService.ts
@@ -49,6 +49,7 @@ export class UserService {
console.log(this.user);
}
+ // TODO find all refs to this, make sure everything is well typed
public static get Instance() {
return this._instance || (this._instance = new this());
}
diff --git a/ui/src/services/WebSocketService.ts b/ui/src/services/WebSocketService.ts
index e72a2871..7b338c60 100644
--- a/ui/src/services/WebSocketService.ts
+++ b/ui/src/services/WebSocketService.ts
@@ -67,12 +67,19 @@ export class WebSocketService {
.subscribe();
console.log(`Connected to ${wsUri}`);
+
+ if (UserService.Instance.user) {
+ }
}
public static get Instance() {
return this._instance || (this._instance = new this());
}
+ public userJoin() {
+ this.wsSendWrapper(UserOperation.ListCategories, undefined);
+ }
+
public login(loginForm: LoginForm) {
this.subject.next(this.wsSendWrapper(UserOperation.Login, loginForm));
}
@@ -125,6 +132,7 @@ export class WebSocketService {
this.subject.next(this.wsSendWrapper(UserOperation.CreatePost, postForm));
}
+ // TODO strictly type these
public getPost(postId: number) {
let data = { id: postId, auth: UserService.Instance.auth };
this.subject.next(this.wsSendWrapper(UserOperation.GetPost, data));