aboutsummaryrefslogtreecommitdiff
path: root/src/components/MultiplayerGrid.js
diff options
context:
space:
mode:
authorMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-08-01 02:34:59 +0530
committerMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-08-01 02:34:59 +0530
commitb8babd592b60b1a2cfedac3956184207a3d4bb8d (patch)
tree3aa3f708e3f3c6b7d804ecdc53c4fce755853c91 /src/components/MultiplayerGrid.js
parent1a40b90e29dc61ed28ad251b49e9175a2215c3d0 (diff)
created menu entry to enter join code
Diffstat (limited to 'src/components/MultiplayerGrid.js')
-rw-r--r--src/components/MultiplayerGrid.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/components/MultiplayerGrid.js b/src/components/MultiplayerGrid.js
index 7c00f17..d7eae36 100644
--- a/src/components/MultiplayerGrid.js
+++ b/src/components/MultiplayerGrid.js
@@ -29,6 +29,7 @@ const MultiplayerGrid = (props) => {
const turn = props.turn;
const isHost = props.isHost;
+ const joinCode = props.joinCode;
const setMessage = props.setMessage;
const setShowMessage = props.setShowMessage;
@@ -48,7 +49,7 @@ const MultiplayerGrid = (props) => {
setTimeout(() => setShowMessage(false), 3000)
})
} else {
- socket.emit("join", prompt("Enter ID"));
+ socket.emit("join", joinCode);
// error if room doesn't exist
socket.on("join failed", () => {
@@ -57,7 +58,7 @@ const MultiplayerGrid = (props) => {
setTimeout(() => window.location.reload(), 3000)
});
}
- }, [isHost, setMessage, setShowMessage]);
+ }, [isHost, setMessage, setShowMessage, joinCode]);
const getBoard = (index) => {
// if it's not your turn you can't play