From 493acb2b3b21f592d0ab958ba2875bb412eb8468 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sun, 31 May 2020 18:01:00 -0700 Subject: [PATCH] Return the actual game object from create_game, not just the ID It was confusing for "create_game" to not return the obvious thing, (the game that it just created). And now that a game has an "id" property, it's easy enough to use that when needed. --- lmno.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lmno.js b/lmno.js index 5d7d568..9998c73 100644 --- a/lmno.js +++ b/lmno.js @@ -72,7 +72,7 @@ class LMNO { this.games[id] = game; - return id; + return game; } } @@ -108,8 +108,8 @@ function lmno_canonize(id) { app.post('/new/:game_engine', (request, response) => { const game_engine = request.params.game_engine; - const game_id = lmno.create_game(game_engine); - response.send(JSON.stringify(game_id)); + const game = lmno.create_game(game_engine); + response.send(JSON.stringify(game.id)); }); /* Redirect any requests to a game ID at the top-level. -- 2.43.0