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,
}
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