Skip to content

Commit

Permalink
Merge pull request #75 from Joseonpaldo/minseok
Browse files Browse the repository at this point in the history
lobby room delete fix
  • Loading branch information
themerous authored Sep 14, 2024
2 parents 91d48d8 + ca65035 commit 8f02c84
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
20 changes: 16 additions & 4 deletions src/components/game/Lobby.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
};

Expand Down
3 changes: 2 additions & 1 deletion src/components/userManagement/AddNewUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 8f02c84

Please sign in to comment.