diff --git a/src/components/game/Lobby.js b/src/components/game/Lobby.js index 5026b9c..e44816a 100644 --- a/src/components/game/Lobby.js +++ b/src/components/game/Lobby.js @@ -555,16 +555,28 @@ const Lobby = () => { return res.data; } + //방장 roomcheck useEffect(() => { + if (roomId === null){ + return; + } + + const fetchRoomName1 = async() => { + const response = await apiAxiosInstance.get(`/roomName/${roomId}`) + .then(res => { + if(res.data === ""){ + alert('존재하지 않는 방입니다'); + window.close(); + } + }); + } + const checkRoom = async () => { if (userData != null && userData.user_id != null) { const result = await roomCheck(roomId, userData.user_id); console.log(result); - // if(!result){ - // alert("존재하지 않는방"); - // window.close(); - // } setRoomchecking(result); + fetchRoomName1(); } }; diff --git a/src/components/userManagement/AddNewUser.tsx b/src/components/userManagement/AddNewUser.tsx index b80e58e..29ea30c 100644 --- a/src/components/userManagement/AddNewUser.tsx +++ b/src/components/userManagement/AddNewUser.tsx @@ -37,7 +37,8 @@ const AddNewUser: FC = () => { jwt : token, }, }); - location.href = "/lobby/" + response.data; + // location.href = "/lobby/" + response.data; + window.open("/lobby/" + response.data); } catch (error) { console.error('Error creating game room:', error); }