diff --git a/ui/src/interfaces.ts b/ui/src/interfaces.ts index cd3961b5f..5022d8176 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 03380e593..0c3325a09 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 e72a28716..7b338c60a 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));