server for my chess game
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | src/index.js | 4 |
2 files changed, 4 insertions, 2 deletions
@@ -6,7 +6,7 @@ .idea .DS_Store /src/test.js -/src/test.mjs +*.mjs npm-debug.log* yarn-debug.log* diff --git a/src/index.js b/src/index.js index 9f62ca4..a839b0d 100644 --- a/src/index.js +++ b/src/index.js @@ -327,8 +327,10 @@ function handle_move(data, ws) { function handle_undo(data, ws) { const gc = data.gamecode; - if (signal_other(data, ws, HEADERS.undo) && data.accepted == true) + if (signal_other(data, ws, HEADERS.undo) && data.accepted == true) { games[gc].pop_move(); + if (data.two === true) games[gc].pop_move(); + } } function handle_spectate(data, ws) { |