diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2017-07-25 00:35:58 +0200 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2017-07-25 00:35:58 +0200 |
commit | a479211c9aa3c5830fcdf1da801032aa36d0de6e (patch) | |
tree | 93d0c589e6f3f4b8bc1ba4598f5f3fa414f96127 /frontend/src | |
parent | Fix types in websocket.js (diff) | |
download | seven-wonders-a479211c9aa3c5830fcdf1da801032aa36d0de6e.tar.gz seven-wonders-a479211c9aa3c5830fcdf1da801032aa36d0de6e.tar.bz2 seven-wonders-a479211c9aa3c5830fcdf1da801032aa36d0de6e.zip |
Fix message.body type using ternary
Diffstat (limited to 'frontend/src')
-rw-r--r-- | frontend/src/api/websocket.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/frontend/src/api/websocket.js b/frontend/src/api/websocket.js index d145076b..5adae17b 100644 --- a/frontend/src/api/websocket.js +++ b/frontend/src/api/websocket.js @@ -35,7 +35,7 @@ export class JsonStompClient { static parseBody<T>(message: Message): T | void { try { - return message.body && JSON.parse(message.body); + return message.body ? JSON.parse(message.body) : undefined; } catch (jsonParseError) { throw new Error('Cannot parse websocket message as JSON: ' + jsonParseError.message); } |