summaryrefslogtreecommitdiff
path: root/src/main/resources/static
diff options
context:
space:
mode:
authorjbion <joffrey.bion@amadeus.com>2016-12-19 22:13:42 +0100
committerjbion <joffrey.bion@amadeus.com>2016-12-19 22:13:42 +0100
commitb8cff38a1cdddad1baad754f6a813bc26cafe0d9 (patch)
tree6b0392862eb4d3d11f57e5f854908fd1b834fdad /src/main/resources/static
parentAdjust exceptions visibility (diff)
downloadseven-wonders-b8cff38a1cdddad1baad754f6a813bc26cafe0d9.tar.gz
seven-wonders-b8cff38a1cdddad1baad754f6a813bc26cafe0d9.tar.bz2
seven-wonders-b8cff38a1cdddad1baad754f6a813bc26cafe0d9.zip
Add response with list of games at subscription to /topic/games
Diffstat (limited to 'src/main/resources/static')
-rw-r--r--src/main/resources/static/app.js11
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) {
bgstack15