Skip to content

Commit ec7b42b

Browse files
authored
Merge pull request #274 from prgrms-web-devcourse-final-project/fix/273-sse-message
[fix] SSE 메세지 변경
2 parents c14fd4d + 8e2887e commit ec7b42b

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

src/components/modalSheet/ChatActionButtons.tsx

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface ChatActionButtonsProps {
1414
recordId: number;
1515
isChatting: boolean;
1616
isPlaying: boolean;
17-
isOwnPost: boolean; // 본인 글 여부(임시)
17+
isOwnPost: boolean; // 본인 글 여부
1818
authorId: string; // 작성자 id
1919
onPlayPauseToggle: () => void;
2020
}
@@ -65,31 +65,23 @@ function ChatActionButtons({
6565
//채팅 요청
6666
//요청 보내면 sse로 recordId, 보낸 사람 정보 보내줘야 함
6767
const request = async () => {
68-
if (!recordId) {
69-
console.log('recordId가 존재하지 않습니다.');
70-
return;
71-
}
68+
// if (!recordId) {
69+
// console.log('recordId가 존재하지 않습니다.');
70+
// return;
71+
// }
7272
try {
73-
const data = await requestChat(recordId);
74-
console.log(data);
75-
if (data.data === '요청은 갔지만, 상대방의 SSE가 없어 알림이 전송되지 않았습니다.') {
73+
const { code } = await requestChat(recordId);
74+
console.log('code', code);
75+
if (code === 200) {
76+
openSheet('isRequestSendingSheetOpen');
77+
} else if (code === 202) {
7678
openModal({
77-
title: 'SSE가 연결되지 않았습니다',
79+
title: '현재 로그아웃 중입니다.',
7880
onConfirm: () => {
7981
closeModal();
8082
cancel();
8183
},
8284
});
83-
return;
84-
} else if (data.message.includes('후에')) {
85-
openModal({
86-
title: data.message,
87-
onConfirm: () => {
88-
closeModal();
89-
},
90-
});
91-
} else if (data.code === 200) {
92-
openSheet('isRequestSendingSheetOpen');
9385
} else {
9486
throw new Error('잠시 후 다시 시도해 주세요');
9587
}

0 commit comments

Comments
 (0)