X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Futils%2FgameStorage.js;h=dc653794d36a2b567371efed97013d134e29adc9;hb=92b82defacccf9c4d3755924a71fcb584002ccc6;hp=0284763a882d24a39e02618ab7022a1f508680d5;hpb=3d55deea9a2011c38d8d0067bd57fc889958bec2;p=vchess.git diff --git a/client/src/utils/gameStorage.js b/client/src/utils/gameStorage.js index 0284763a..dc653794 100644 --- a/client/src/utils/gameStorage.js +++ b/client/src/utils/gameStorage.js @@ -79,8 +79,7 @@ export const GameStorage = gid: gameId, newObj: { - // TODO: I think stringify isn't requuired here (see ajax() ) - move: JSON.stringify(obj.move), //may be undefined... + move: obj.move, //may be undefined... fen: obj.fen, score: obj.score, } @@ -134,7 +133,11 @@ export const GameStorage = if (Number.isInteger(gameId) || !isNaN(parseInt(gameId))) { ajax("/games", "GET", {gid:gameId}, res => { - callback(res.game); + let game = res.game; + game.moves.forEach(m => { + m.squares = JSON.parse(m.squares); + }); + callback(game); }); } else //local game