]> Untitled Git - lemmy.git/commitdiff
Starting to work on websocket scopes.
authorDessalines <tyhou13@gmx.com>
Sun, 26 Jan 2020 17:23:28 +0000 (12:23 -0500)
committerDessalines <tyhou13@gmx.com>
Sun, 26 Jan 2020 17:23:28 +0000 (12:23 -0500)
ui/src/interfaces.ts
ui/src/services/UserService.ts
ui/src/services/WebSocketService.ts

index cd3961b5f7252f11b586bbd7d95f4647dc7f97f7..5022d81765e50817ae04cc0ec6d64e27f67b7084 100644 (file)
@@ -41,6 +41,7 @@ export enum UserOperation {
   CreatePrivateMessage,
   EditPrivateMessage,
   GetPrivateMessages,
+  UserJoin,
 }
 
 export enum CommentSortType {
index 03380e593021373bbd5a5d3cf0e2016f1acb0438..0c3325a096f016e5a1d4e7f7b5a95baebfad401d 100644 (file)
@@ -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());
   }
index e72a28716ffdc8d1d17876aa7f40dc1829e2acf0..7b338c60aaa53d5971eb462ae3d80633b820003c 100644 (file)
@@ -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));