Skip to content

Commit 2e7e6a9

Browse files
committed
fix: 어드민 금칙어 에러 반영
1 parent 4e38cbc commit 2e7e6a9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/pages/Admin/components/AddRollingPaperModal.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ChangeEvent, FormEvent, useState } from 'react';
33

44
import { postNewRollingPaper } from '@/apis/rolling';
55
import ModalOverlay from '@/components/ModalOverlay';
6+
import { AxiosError } from 'axios';
67

78
interface AddRollingPaperModalProps {
89
currentPage: number | string;
@@ -22,8 +23,12 @@ export default function AddRollingPaperModal({ currentPage, onClose }: AddRollin
2223
onClose();
2324
queryClient.invalidateQueries({ queryKey: ['admin-rolling-paper', currentPage] });
2425
},
25-
onError: () => {
26-
setError('편지 작성에 실패했어요. 다시 시도해주세요.');
26+
onError: (err: AxiosError<{ code: string; message: string }>) => {
27+
if (err.response?.data.code === 'MOD-003') {
28+
setError('금칙어가 포함되어 있어요. 다시 작성해주세요.');
29+
} else {
30+
setError('편지 작성에 실패했어요. 다시 시도해주세요.');
31+
}
2732
},
2833
});
2934

0 commit comments

Comments
 (0)