diff --git a/ui/src/interfaces.ts b/ui/src/interfaces.ts index cd3961b..5022d81 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 03380e5..0c3325a 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 e72a287..7b338c6 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));