summaryrefslogtreecommitdiffstats
path: root/ui/src/components/comment-form.tsx
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-01-19 00:38:45 -0500
committerDessalines <tyhou13@gmx.com>2020-01-19 00:38:45 -0500
commitdcd60228ed753a146bcb56bb5bf51166835acfb7 (patch)
treef21c87ff98fd81af2d843fe1fe30c45b9e708af4 /ui/src/components/comment-form.tsx
parenta044718066623f19d51196d444bd199c1231cebe (diff)
Strongly typing WebsocketJsonResponse. Forgot comment-form.tsx
Diffstat (limited to 'ui/src/components/comment-form.tsx')
-rw-r--r--ui/src/components/comment-form.tsx18
1 files changed, 9 insertions, 9 deletions
diff --git a/ui/src/components/comment-form.tsx b/ui/src/components/comment-form.tsx
index f5816899..dddcbe72 100644
--- a/ui/src/components/comment-form.tsx
+++ b/ui/src/components/comment-form.tsx
@@ -10,9 +10,9 @@ import {
} from '../interfaces';
import { Subscription } from 'rxjs';
import {
+ wsJsonToRes,
capitalizeFirstLetter,
mentionDropdownFetchLimit,
- msgOp,
mdToHtml,
randomStr,
markdownHelpUrl,
@@ -311,10 +311,10 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
this.userSub = WebSocketService.Instance.subject.subscribe(
msg => {
- let op: UserOperation = msgOp(msg);
- if (op == UserOperation.Search) {
- let res: SearchResponse = msg;
- let users = res.users.map(u => {
+ let res = wsJsonToRes(msg);
+ if (res.op == UserOperation.Search) {
+ let data = res.data as SearchResponse;
+ let users = data.users.map(u => {
return { key: u.name };
});
cb(users);
@@ -343,10 +343,10 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
this.communitySub = WebSocketService.Instance.subject.subscribe(
msg => {
- let op: UserOperation = msgOp(msg);
- if (op == UserOperation.Search) {
- let res: SearchResponse = msg;
- let communities = res.communities.map(u => {
+ let res = wsJsonToRes(msg);
+ if (res.op == UserOperation.Search) {
+ let data = res.data as SearchResponse;
+ let communities = data.communities.map(u => {
return { key: u.name };
});
cb(communities);