Skip to content

Commit e70694a

Browse files
committed
fix: 채팅 요청 로직 수정
1 parent ec7b42b commit e70694a

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

src/components/modalSheet/ChatActionButtons.tsx

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import playIcon from '@assets/icons/play/play-icon-gray.svg';
66
import pauseIcon from '@assets/icons/pause-icon-gray.svg';
77
import { useNavigate } from 'react-router';
88
import { useSheetStore } from '@/store/sheetStore';
9-
import { cancelChatRequest, requestChat } from '@/apis/chat';
9+
// import { cancelChatRequest, requestChat } from '@/apis/chat';
10+
import { requestChat } from '@/apis/chat';
1011
import { useModalStore } from '@/store/modalStore';
11-
import { useChatStore } from '@/store/chatStore';
12+
// import { useChatStore } from '@/store/chatStore';
1213

1314
interface ChatActionButtonsProps {
1415
recordId: number;
@@ -30,8 +31,9 @@ function ChatActionButtons({
3031
}: ChatActionButtonsProps) {
3132
const navigate = useNavigate();
3233

33-
const { openSheet, closeSheet, currentRecord } = useSheetStore(); // 모달 시트
34-
const { pastRecord } = useChatStore();
34+
// const { openSheet, closeSheet, currentRecord } = useSheetStore(); // 모달 시트
35+
const { openSheet } = useSheetStore(); // 모달 시트
36+
// const { pastRecord } = useChatStore();
3537
const { openModal, closeModal } = useModalStore();
3638

3739
const handleGoToUserPage = () => {
@@ -40,27 +42,27 @@ function ChatActionButtons({
4042
};
4143

4244
//채팅 요청 취소(요청 보낸 사람)
43-
const cancel = async () => {
44-
if (!currentRecord?.recordId && !pastRecord?.recordId) {
45-
console.log('record가 존재하지 않습니다');
46-
return;
47-
}
48-
try {
49-
console.log(currentRecord);
50-
const { code } = await cancelChatRequest(
51-
currentRecord?.recordId || Number(pastRecord?.recordId),
52-
);
53-
if (code === 200) {
54-
console.log('취소 요청 성공');
55-
closeSheet('isRequestSendingSheetOpen');
56-
} else {
57-
throw new Error('취소 요청 실패');
58-
}
59-
} catch (error) {
60-
console.error(error);
61-
closeSheet('isRequestSendingSheetOpen'); // 취소 요청 실패시 창 닫기
62-
}
63-
};
45+
// const cancel = async () => {
46+
// if (!currentRecord?.recordId && !pastRecord?.recordId) {
47+
// console.log('record가 존재하지 않습니다');
48+
// return;
49+
// }
50+
// try {
51+
// console.log(currentRecord);
52+
// const { code } = await cancelChatRequest(
53+
// currentRecord?.recordId || Number(pastRecord?.recordId),
54+
// );
55+
// if (code === 200) {
56+
// console.log('취소 요청 성공');
57+
// closeSheet('isRequestSendingSheetOpen');
58+
// } else {
59+
// throw new Error('취소 요청 실패');
60+
// }
61+
// } catch (error) {
62+
// console.error(error);
63+
// closeSheet('isRequestSendingSheetOpen'); // 취소 요청 실패시 창 닫기
64+
// }
65+
// };
6466

6567
//채팅 요청
6668
//요청 보내면 sse로 recordId, 보낸 사람 정보 보내줘야 함
@@ -71,15 +73,14 @@ function ChatActionButtons({
7173
// }
7274
try {
7375
const { code } = await requestChat(recordId);
74-
console.log('code', code);
7576
if (code === 200) {
7677
openSheet('isRequestSendingSheetOpen');
7778
} else if (code === 202) {
7879
openModal({
7980
title: '현재 로그아웃 중입니다.',
8081
onConfirm: () => {
8182
closeModal();
82-
cancel();
83+
// cancel();
8384
},
8485
});
8586
} else {

0 commit comments

Comments
 (0)