diff options
Diffstat (limited to 'src/components/MultiplayerGrid.js')
-rw-r--r-- | src/components/MultiplayerGrid.js | 5 |
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 |