From 11667c79617c057357f2a176c798bfee3b190771 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Wed, 18 Dec 2019 13:07:40 +0100
Subject: [PATCH] Rename gameId --> id in Game.vue

---
 client/src/utils/gameStorage.js |  4 ++--
 client/src/views/Game.vue       |  4 +---
 client/src/views/Hall.vue       | 10 +++++-----
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/client/src/utils/gameStorage.js b/client/src/utils/gameStorage.js
index dc653794..6b446321 100644
--- a/client/src/utils/gameStorage.js
+++ b/client/src/utils/gameStorage.js
@@ -1,6 +1,6 @@
 // Game object: {
 //   // Static informations:
-//   gameId: string
+//   id: string
 //   vname: string,
 //   fenStart: string,
 //   players: array of sid+id+name,
@@ -39,7 +39,7 @@ function dbOperation(callback)
       alert("Error while loading database: " + event.target.errorCode);
     };
     // Create objectStore for vchess->games
-    let objectStore = db.createObjectStore("games", { keyPath: "gameId" });
+    let objectStore = db.createObjectStore("games", { keyPath: "id" });
     objectStore.createIndex("score", "score"); //to search by game result
   }
 }
diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue
index 4d44cd1a..89bef8da 100644
--- a/client/src/views/Game.vue
+++ b/client/src/views/Game.vue
@@ -419,9 +419,7 @@ export default {
       else
       {
         // Local or corr game
-        GameStorage.get(this.gameRef.id, (game) => {
-          afterRetrieval(game);
-        });
+        GameStorage.get(this.gameRef.id, afterRetrieval);
       }
     },
     // Post-process a move (which was just played)
diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue
index 1ad88b4e..287788a1 100644
--- a/client/src/views/Hall.vue
+++ b/client/src/views/Hall.vue
@@ -381,8 +381,8 @@ export default {
           else
           {
             this.infoMessage = "New game started: " +
-              "<a href='#/game/" + data.gameInfo.gameId + "'>" +
-              "#/game/" + data.gameInfo.gameId + "</a>";
+              "<a href='#/game/" + data.gameInfo.id + "'>" +
+              "#/game/" + data.gameInfo.id + "</a>";
             let modalBox = document.getElementById("modalInfo");
             modalBox.checked = true;
             setTimeout(() => { modalBox.checked = false; }, 3000);
@@ -539,7 +539,7 @@ export default {
       // These game informations will be sent to other players
       const gameInfo =
       {
-        gameId: getRandString(),
+        id: getRandString(),
         fen: c.fen || V.GenRandInitFen(),
         players: shuffle([c.from, c.seat]), //white then black
         vid: c.vid,
@@ -572,7 +572,7 @@ export default {
           "POST",
           {gameInfo: gameInfo, cid: c.id}, //cid useful to delete challenge
           response => {
-            gameInfo.gameId = response.gameId;
+            gameInfo.id = response.gameId;
             tryNotifyOpponent();
             this.$router.push("/game/" + response.gameId);
           }
@@ -594,7 +594,7 @@ export default {
       GameStorage.add(game);
       if (this.st.settings.sound >= 1)
         new Audio("/sounds/newgame.mp3").play().catch(err => {});
-      this.$router.push("/game/" + gameInfo.gameId);
+      this.$router.push("/game/" + gameInfo.id);
     },
   },
 };
-- 
2.44.0