codestates / codestates/BanThing

[Error Handling] 채팅창이 켜진 상태에서 지도 클릭시 오류

Open
#110 0 comments 0 reactions 1 assignee Claimed by @tmdqls2257 View on GitHub
client error solved
Dominant language
TypeScript
Stars
0
Forks
2
PR merge metrics
No merged PRs in 30d

Description

### 어떤 에러인가요?
![image](https://user-images.githubusercontent.com/54207332/154783263-5e90f0bc-3521-486b-9a7e-4f2cd25b3df6.png)

### 에러 핸들링 방법
- 처음에는 chatRoom.style.display === 'none'일 경우에만 맵 클릭 이벤트가 나타나게 설정해주었는데 이러면 아예 메인페이지에서 맵클릭 이벤트가 발생하지 않는 오류가 생겼다.
- 생각을 해보니 채팅룸에 들어가 있으면 자신이 속한 채팅룸 이외의 방을 못들어가게 해주기만 하고 자신이 속한 방을 참여할 수 있게 해둔다면 해결 될 것 같다.
```
if (chatRoom.style.display === 'none') {
window.kakao.maps.event.addListener(marker, 'click', function () {
createElement.style.display = 'none';
chatRoom.style.display = 'none';
joinRoom.style.display = 'flex';
});
window.kakao.maps.event.addListener(map, 'click', function () {
joinRoom.style.display = 'none';
makeRoom.style.display = 'none';
chatRoom.style.display = 'none';
createElement.style.display = 'flex';
});
}
```

### 에러 핸들링을 위해 참고한 레퍼런스 링크
- Memory-It 의 Error Handling 예시입니다.
[링크](https://github.com/codestates/Memory-It/issues/205)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.