diff options
Diffstat (limited to 'src/main/resources/static/app.js')
-rw-r--r-- | src/main/resources/static/app.js | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/main/resources/static/app.js b/src/main/resources/static/app.js index 2b6b160b..0d68d2ef 100644 --- a/src/main/resources/static/app.js +++ b/src/main/resources/static/app.js @@ -24,15 +24,10 @@ function connect() { }); stompClient.subscribe('/topic/games', function (msg) { - var game = JSON.parse(msg.body); - if (Array.isArray(game)) { - console.log("Received new games: " + game); - for (var i = 0; i < game.length; i++) { - addNewGame(game[i]); - } - } else { - console.log("Received new game: " + game); - addNewGame(game); + var games = JSON.parse(msg.body); + console.log("Received new games: " + games); + for (var i = 0; i < games.length; i++) { + addNewGame(games[i]); } }); @@ -45,7 +40,7 @@ function connect() { } function disconnect() { - if (stompClient != null) { + if (stompClient !== null) { stompClient.disconnect(); } setConnected(false); |