summaryrefslogtreecommitdiff
path: root/frontend/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/utils')
-rw-r--r--frontend/src/utils/websocket.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/frontend/src/utils/websocket.js b/frontend/src/utils/websocket.js
index b01531cf..6acd0806 100644
--- a/frontend/src/utils/websocket.js
+++ b/frontend/src/utils/websocket.js
@@ -41,7 +41,9 @@ export const createWsConnection = (headers: Object = {}): Promise<SocketObjectTy
export const createSubscriptionChannel = (socket: SocketType, path: string) => {
return eventChannel((emitter: (data: any) => void) => {
const socketSubscription: SocketSubscriptionType = socket.subscribe(path, (event: SocketEventType) => {
- emitter(JSON.parse(event.body));
+ // not all events have a body
+ const value = event.body && JSON.parse(event.body);
+ emitter(value);
});
return () => socketSubscription.unsubscribe();
});
bgstack15