X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Futils%2FcompgameStorage.js;h=c8463047fd5b1e07c6f49b302a9515f16baf7b2a;hb=a550511adb077ee08686934f67c64b0832d2bb36;hp=655fd6bf8c69838d14c3032fe0d948066a9d0f88;hpb=5f918a278904266a2a66a3c8e2a3655f37c2d2a7;p=vchess.git diff --git a/client/src/utils/compgameStorage.js b/client/src/utils/compgameStorage.js index 655fd6bf..c8463047 100644 --- a/client/src/utils/compgameStorage.js +++ b/client/src/utils/compgameStorage.js @@ -37,6 +37,7 @@ function dbOperation(callback) { } export const CompgameStorage = { + add: function(game) { dbOperation((err, db) => { if (err) return; @@ -55,7 +56,7 @@ export const CompgameStorage = { .objectStore("compgames"); objectStore.get(gameId).onsuccess = function(event) { // Ignoring error silently: shouldn't happen now. TODO? - if (event.target.result) { + if (!!event.target.result) { const game = event.target.result; Object.keys(obj).forEach(k => { if (k == "move") game.moves.push(obj[k]); @@ -90,4 +91,5 @@ export const CompgameStorage = { } }); } + };