diff options
Diffstat (limited to 'src/main/resources/static/app.js')
-rw-r--r-- | src/main/resources/static/app.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/resources/static/app.js b/src/main/resources/static/app.js index ace23fdb..2b6b160b 100644 --- a/src/main/resources/static/app.js +++ b/src/main/resources/static/app.js @@ -25,8 +25,15 @@ function connect() { stompClient.subscribe('/topic/games', function (msg) { var game = JSON.parse(msg.body); - console.log("Received new game: " + game); - addNewGame(game); + 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); + } }); stompClient.subscribe('/user/queue/join-game', function (msg) { |