From: Dessalines Date: Sun, 26 Jan 2020 17:23:28 +0000 (-0500) Subject: Starting to work on websocket scopes. X-Git-Url: http://these/git/?a=commitdiff_plain;h=65adb0d15dcb10382dadca2694ee17b206c384fd;p=lemmy.git Starting to work on websocket scopes. --- diff --git a/ui/src/interfaces.ts b/ui/src/interfaces.ts index cd3961b5..5022d817 100644 --- a/ui/src/interfaces.ts +++ b/ui/src/interfaces.ts @@ -41,6 +41,7 @@ export enum UserOperation { CreatePrivateMessage, EditPrivateMessage, GetPrivateMessages, + UserJoin, } export enum CommentSortType { 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));