From a044718066623f19d51196d444bd199c1231cebe Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sat, 18 Jan 2020 23:54:10 -0500 Subject: First pass at fixing UI to work with new websocketresponses. --- ui/src/utils.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ui/src/utils.ts') diff --git a/ui/src/utils.ts b/ui/src/utils.ts index dc221716..363de663 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -15,6 +15,7 @@ import { SortType, ListingType, SearchType, + WebSocketResponse, } from './interfaces'; import { UserService } from './services/UserService'; import markdown_it from 'markdown-it'; @@ -38,9 +39,12 @@ export function randomStr() { .substr(2, 10); } -export function msgOp(msg: any): UserOperation { +export function wsJsonToRes(msg: any): WebSocketResponse { let opStr: string = msg.op; - return UserOperation[opStr]; + return { + op: UserOperation[opStr], + data: msg.data, + }; } export const md = new markdown_it({ -- cgit v1.2.3 From dcd60228ed753a146bcb56bb5bf51166835acfb7 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sun, 19 Jan 2020 00:38:45 -0500 Subject: Strongly typing WebsocketJsonResponse. Forgot comment-form.tsx --- ui/src/utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ui/src/utils.ts') diff --git a/ui/src/utils.ts b/ui/src/utils.ts index 363de663..90ef6899 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -16,6 +16,7 @@ import { ListingType, SearchType, WebSocketResponse, + WebSocketJsonResponse, } from './interfaces'; import { UserService } from './services/UserService'; import markdown_it from 'markdown-it'; @@ -39,7 +40,7 @@ export function randomStr() { .substr(2, 10); } -export function wsJsonToRes(msg: any): WebSocketResponse { +export function wsJsonToRes(msg: WebSocketJsonResponse): WebSocketResponse { let opStr: string = msg.op; return { op: UserOperation[opStr], -- cgit v1.2.3