Skip to content

Commit ea5a7d1

Browse files
committed
refact: 구매자가 있는 이벤트 삭제 방지 구현
1 parent 617da75 commit ea5a7d1

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/pages/join/LogoutPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const LogoutPage = () => {
2222
'code' in error &&
2323
(
2424
(error as { code?: string }).code === 'TOKEN4001' ||
25-
(error as { code?: string }).code === 'TOKEN4004')
25+
(error as { code?: string }).code === 'TOKEN4004'
26+
)
2627
) {
2728
// 토큰 만료로 인한 자동 로그아웃이므로 조용히 처리
2829
console.log('토큰 만료로 인한 자동 로그아웃', error);

src/shared/ui/EventCard.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,17 @@ const EventCard = ({
133133
onDeleteSuccess?.(id);
134134
setIsModalOpen(false);
135135
},
136-
onError: () => {
137-
alert('이벤트 삭제에 실패했습니다.');
136+
onError: (error: unknown) => {
137+
if (
138+
typeof error === 'object' &&
139+
error !== null &&
140+
'code' in error &&
141+
(
142+
error as { code? : string}).code === "EVENT4002"
143+
) {
144+
console.log('참여자로 인한 이벤트 삭제 실패');
145+
alert('구매자가 있는 이벤트는 삭제가 불가합니다.');
146+
}
138147
setIsModalOpen(false);
139148
},
140149
});

0 commit comments

Comments
 (0)