summaryrefslogtreecommitdiffstats
path: root/ui/src/services
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-01-31 22:53:55 -0500
committerDessalines <tyhou13@gmx.com>2020-01-31 22:53:55 -0500
commit895d85782508f0195be3a33e7830748dac89ee53 (patch)
treecd788ba6de4f6d2f9388ea2243eeb1e57f46aeec /ui/src/services
parent7b4bf68486ad46b70e761b88be4819d4fc044f91 (diff)
parent8cbdba1da39c15d2a3d13919398fc4d4c8ef2c6c (diff)
Merge branch 'dev' into nutomic-api-benchmark
Diffstat (limited to 'ui/src/services')
-rw-r--r--ui/src/services/WebSocketService.ts27
1 files changed, 13 insertions, 14 deletions
diff --git a/ui/src/services/WebSocketService.ts b/ui/src/services/WebSocketService.ts
index b4042194..a7e9b7e0 100644
--- a/ui/src/services/WebSocketService.ts
+++ b/ui/src/services/WebSocketService.ts
@@ -9,9 +9,12 @@ import {
CommentForm,
SaveCommentForm,
CommentLikeForm,
+ GetPostForm,
GetPostsForm,
CreatePostLikeForm,
+ GetCommunityForm,
FollowCommunityForm,
+ GetFollowedCommunitiesForm,
GetUserDetailsForm,
ListCommunitiesForm,
GetModlogForm,
@@ -35,6 +38,7 @@ import {
PrivateMessageForm,
EditPrivateMessageForm,
GetPrivateMessagesForm,
+ MessageType,
} from '../interfaces';
import { webSocket } from 'rxjs/webSocket';
import { Subject } from 'rxjs';
@@ -108,9 +112,9 @@ export class WebSocketService {
}
public getFollowedCommunities() {
- let data = { auth: UserService.Instance.auth };
+ let form: GetFollowedCommunitiesForm = { auth: UserService.Instance.auth };
this.subject.next(
- this.wsSendWrapper(UserOperation.GetFollowedCommunities, data)
+ this.wsSendWrapper(UserOperation.GetFollowedCommunities, form)
);
}
@@ -125,19 +129,14 @@ export class WebSocketService {
this.subject.next(this.wsSendWrapper(UserOperation.CreatePost, postForm));
}
- public getPost(postId: number) {
- let data = { id: postId, auth: UserService.Instance.auth };
- this.subject.next(this.wsSendWrapper(UserOperation.GetPost, data));
- }
-
- public getCommunity(communityId: number) {
- let data = { id: communityId, auth: UserService.Instance.auth };
- this.subject.next(this.wsSendWrapper(UserOperation.GetCommunity, data));
+ public getPost(form: GetPostForm) {
+ this.setAuth(form, false);
+ this.subject.next(this.wsSendWrapper(UserOperation.GetPost, form));
}
- public getCommunityByName(name: string) {
- let data = { name: name, auth: UserService.Instance.auth };
- this.subject.next(this.wsSendWrapper(UserOperation.GetCommunity, data));
+ public getCommunity(form: GetCommunityForm) {
+ this.setAuth(form, false);
+ this.subject.next(this.wsSendWrapper(UserOperation.GetCommunity, form));
}
public createComment(commentForm: CommentForm) {
@@ -310,7 +309,7 @@ export class WebSocketService {
);
}
- private wsSendWrapper(op: UserOperation, data: any) {
+ private wsSendWrapper(op: UserOperation, data: MessageType) {
let send = { op: UserOperation[op], data: data };
console.log(send);
return send;