summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjbion <joffrey.bion@amadeus.com>2019-02-22 21:26:19 +0100
committerjbion <joffrey.bion@amadeus.com>2019-02-22 21:31:17 +0100
commitb3a5f5cbc343ffdd654de70262847220e9533adc (patch)
tree1e1601132e22aecf8ae61668f2ce54e2c25eb660
parentMake login input large (diff)
downloadseven-wonders-b3a5f5cbc343ffdd654de70262847220e9533adc.tar.gz
seven-wonders-b3a5f5cbc343ffdd654de70262847220e9533adc.tar.bz2
seven-wonders-b3a5f5cbc343ffdd654de70262847220e9533adc.zip
Fix websocket value when no message body is received
-rw-r--r--frontend/src/api/websocket.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/frontend/src/api/websocket.js b/frontend/src/api/websocket.js
index 6813676c..2fc045ff 100644
--- a/frontend/src/api/websocket.js
+++ b/frontend/src/api/websocket.js
@@ -7,7 +7,7 @@ const DEFAULT_DEBUG_OPTIONS = {
debug: process.env.NODE_ENV !== 'production',
};
-export type Callback<T> = (value?: T) => void;
+export type Callback<T> = (value: T) => void;
export type UnsubscribeFn = () => void;
export type SubscribeFn<T> = (callback: Callback<T>) => UnsubscribeFn;
@@ -28,7 +28,7 @@ export class JsonStompClient {
const socketSubscription: Subscription = this.client.subscribe(path, (message: Message) => {
// not all frames have a JSON body
const value: T | void = message && JsonStompClient.parseBody(message);
- callback(value);
+ callback(value || {});
});
return () => socketSubscription.unsubscribe();
}
bgstack15