From c3e1feffb9ac607bb73de6d4164be5fd23e41871 Mon Sep 17 00:00:00 2001
From: MikunoNaka <bokuwakanojogahoshii@yahoo.com>
Date: Thu, 22 Jul 2021 14:58:12 +0530
Subject: fixed wrong winner showing

---
 src/components/MultiplayerGrid.tsx | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'src/components/MultiplayerGrid.tsx')

diff --git a/src/components/MultiplayerGrid.tsx b/src/components/MultiplayerGrid.tsx
index 2643667..89ab564 100644
--- a/src/components/MultiplayerGrid.tsx
+++ b/src/components/MultiplayerGrid.tsx
@@ -16,7 +16,7 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-import React, { useState, useEffect, Dispatch, SetStateAction } from 'react';
+import React, { useState/*, useEffect*/, Dispatch, SetStateAction } from 'react';
 import { io } from 'socket.io-client';
 import Box from './Box';
 import './style.css';
@@ -49,10 +49,14 @@ const MultiplayerGrid: React.FC<Props> = (props) => {
     const gameWinner = winner < 2 ? (winner === 1 ? "X" : "O") : "Draw";
     props.setMessage(`WINNER: ${gameWinner}`);
     props.setShowMessage(true);
+    console.log(gameWinner, "X: ", props.scoreX, "O: ", props.scoreO);
+
     gameWinner === "Draw" || (gameWinner === "X"
       ? props.setScoreX(props.scoreX + 1)
       : props.setScoreO(props.scoreO + 1));
-    socket.emit("update-remote-board", [2,2,2,2,2,2,2,2,2]);
+
+    console.log(gameWinner, "X: ", props.scoreX, "O: ", props.scoreO);
+    socket.emit("update-remote-data", {board: [2,2,2,2,2,2,2,2,2], turn: turn});
     winner < 2 && props.setTurn(winner); // set turn to prev. winner
   }
 
-- 
cgit v1.2.3

