Skip to content

Commit

Permalink
fix: 연필 권한 기능 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Haze10425 committed Feb 18, 2024
1 parent 943921e commit d752f2b
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions src/pages/Room/Room.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ const Room: React.FC = () => {

// 게임 시작 (방장)
const handleStart = () => {
socket.emit('pencil', { isRound: isRound, roomId: roomId });
getAnswer();
socket.emit('gameStart');
handleIsRound();
Expand All @@ -150,6 +151,7 @@ const Room: React.FC = () => {
isRound: isRound,
roomId: Number(roomId),
});
socket.emit('pencil', { isRound: isRound + 1, roomId: roomId });
return roomSetting?.time;
}
socket?.emit('remainTimer', {
Expand Down Expand Up @@ -277,6 +279,7 @@ const Room: React.FC = () => {
socket?.emit('gameEnd', { roomId: roomId });
setStart(false);
setGameEnd(true);
setAnswer('');
}
// console.log(isRound, roomSetting?.round);
};
Expand All @@ -291,29 +294,6 @@ const Room: React.FC = () => {
}
};

// 그리기 권한 업데이트
useEffect(() => {
if (isRound && start) {
fetch(`${api}/api/gameroom/${roomId}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json;charset=utf-8',
},
body: JSON.stringify({
roomId: roomId,
isRound: isRound,
}),
})
.then(res => res.json())
.then(data => {
setUserInfo(data.gameRoomInfo.users);
})
.catch(error => {
console.error(error);
});
}
}, [isRound, start]);

return (
<div className="page room">
<div className="roomArea">
Expand Down

0 comments on commit d752f2b

Please sign in to comment.