Skip to content

Commit

Permalink
Feat #50: 게임방에서 유저 정보 갱신 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
leewooseong committed May 18, 2024
1 parent 8bfec4e commit b779534
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion frontend/app/hooks/useSetupSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ const useSetUpGame = (socket: WebSocket | null) => {
setRoundResults(data.userRank)
}

const successEnterRoom = (userList: IUserInfo[]) => {
setGameUserList(userList)
}

const setUpGame = () => {
if (socket === null || socket.readyState !== WebSocket.OPEN) {
console.log('Socket is null or not connected.')
Expand All @@ -256,7 +260,10 @@ const useSetUpGame = (socket: WebSocket | null) => {
console.log('채팅 수신 응답')
successReceiveChat(event.data)
break

case SOCKET_RES_CODE.ENTER_ROOM_OWNER:
successEnterRoom(responseData.data.userList)
console.log('유저 입장 성공 응답')
break
case SOCKET_RES_CODE.TEAM_SELECT_OWNER:
console.log('팀 선택 성공 응답')
break
Expand Down

0 comments on commit b779534

Please sign in to comment.