server for my chess game
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js4
1 files changed, 3 insertions, 1 deletions
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) {