Skip to content

Commit

Permalink
feat: 시간표 이름 중복 토스트
Browse files Browse the repository at this point in the history
  • Loading branch information
Nangniya committed Oct 16, 2024
1 parent c9da2f1 commit 3b4dcd3
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/components/organisms/AddScheduleForm/AddScheduleForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,18 @@ const AddScheduleForm = ({ onClose }: IProps) => {
const postMutation = useMutation({
mutationFn: (data: IScheduleElementDTO) =>
addScheduleElement(data, userInfo.userName),
onSuccess: () => {
addAlert('강의 추가에 성공했습니다.', 'success');
onClose();
queryClient.invalidateQueries({
queryKey: ['schedule', userInfo.userName],
});
onSuccess: (res) => {
if (res.success) {
addAlert('강의 추가에 성공했습니다.', 'success');
onClose();
queryClient.invalidateQueries({
queryKey: ['schedule', userInfo.userName],
});
} else {
if (res.msg === 'Duplicate ScheduleElement Name') {
addAlert('같은 이름의 강의가 존재합니다.', 'error');
}
}
},
onError: () => {
addAlert('강의 추가를 실패했습니다.', 'error');
Expand Down

0 comments on commit 3b4dcd3

Please sign in to comment.