From dcd60228ed753a146bcb56bb5bf51166835acfb7 Mon Sep 17 00:00:00 2001
From: Dessalines <tyhou13@gmx.com>
Date: Sun, 19 Jan 2020 00:38:45 -0500
Subject: Strongly typing WebsocketJsonResponse. Forgot comment-form.tsx

---
 ui/src/components/comment-form.tsx | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

(limited to 'ui/src/components/comment-form.tsx')

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);
-- 
cgit v1.2.3

