summaryrefslogtreecommitdiffstats
path: root/ui/src/components
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-01-27 21:04:30 -0500
committerDessalines <tyhou13@gmx.com>2020-01-27 21:04:30 -0500
commit2e84441e6635b42065ef646238a6c95aea207548 (patch)
tree53b7db65bb5567e13d9c24a6364cde49224af6a4 /ui/src/components
parent8cfd5f9266a0a93dc47ec2ab6060ee0435276aba (diff)
Strictly typing websocket forms.
Diffstat (limited to 'ui/src/components')
-rw-r--r--ui/src/components/community.tsx11
-rw-r--r--ui/src/components/inbox.tsx4
-rw-r--r--ui/src/components/post.tsx6
3 files changed, 14 insertions, 7 deletions
diff --git a/ui/src/components/community.tsx b/ui/src/components/community.tsx
index 221c9211..3c5f6890 100644
--- a/ui/src/components/community.tsx
+++ b/ui/src/components/community.tsx
@@ -11,6 +11,7 @@ import {
SortType,
Post,
GetPostsForm,
+ GetCommunityForm,
ListingType,
GetPostsResponse,
CreatePostLikeResponse,
@@ -98,11 +99,11 @@ export class Community extends Component<any, State> {
() => console.log('complete')
);
- if (this.state.communityId) {
- WebSocketService.Instance.getCommunity(this.state.communityId);
- } else if (this.state.communityName) {
- WebSocketService.Instance.getCommunityByName(this.state.communityName);
- }
+ let form: GetCommunityForm = {
+ id: this.state.communityId ? this.state.communityId : null,
+ name: this.state.communityName ? this.state.communityName : null,
+ };
+ WebSocketService.Instance.getCommunity(form);
}
componentWillUnmount() {
diff --git a/ui/src/components/inbox.tsx b/ui/src/components/inbox.tsx
index ba5cc6ad..41c1ce60 100644
--- a/ui/src/components/inbox.tsx
+++ b/ui/src/components/inbox.tsx
@@ -38,6 +38,8 @@ enum UnreadType {
Messages,
}
+type ReplyType = Comment | PrivateMessageI;
+
interface InboxState {
unreadOrAll: UnreadOrAll;
unreadType: UnreadType;
@@ -186,7 +188,7 @@ export class Inbox extends Component<any, InboxState> {
}
all() {
- let combined: Array<Comment | PrivateMessageI> = [];
+ let combined: Array<ReplyType> = [];
combined.push(...this.state.replies);
combined.push(...this.state.mentions);
diff --git a/ui/src/components/post.tsx b/ui/src/components/post.tsx
index f57d8913..9ea275ce 100644
--- a/ui/src/components/post.tsx
+++ b/ui/src/components/post.tsx
@@ -23,6 +23,7 @@ import {
SearchType,
SortType,
SearchForm,
+ GetPostForm,
SearchResponse,
GetSiteResponse,
GetCommunityResponse,
@@ -84,7 +85,10 @@ export class Post extends Component<any, PostState> {
() => console.log('complete')
);
- WebSocketService.Instance.getPost(postId);
+ let form: GetPostForm = {
+ id: postId,
+ };
+ WebSocketService.Instance.getPost(form);
}
componentWillUnmount() {