Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[노철] - 토글 에러 핸들링 #373

Merged
merged 2 commits into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/components/ReadOnlyPlan/ReadOnlyPlan.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { PlanData } from '@/types/apis/plan/GetPlan';
import Image from 'next/image';
import { AjajaButton, DebounceSwitchButton, PlanInput, Tag } from '..';
import HelpButton from '../HelpButton/HelpButton';
import { ajajaToast } from '../Toaster/customToast';
import './index.scss';

interface ReadOnlyPlanProps {
Expand Down Expand Up @@ -37,11 +38,19 @@ export default function ReadOnlyPlan({
useToggleAjajaNotificationMutation(id);

const handleToggleIsPublic = () => {
toggleIsPublic(id);
toggleIsPublic(id, {
onError: () => {
ajajaToast.error('변경에 실패했습니다.');
},
});
};

const handleToggleIsCanAjaja = () => {
toggleAjajaNotification(id);
toggleAjajaNotification(id, {
onError: () => {
ajajaToast.error('변경에 실패했습니다.');
},
});
};

return (
Expand Down
1 change: 0 additions & 1 deletion src/hooks/apis/useToggleAjajaNotificationMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ export const useToggleAjajaNotificationMutation = (planId: number) => {
queryKey: [{ planId: planId }, QUERY_KEY.PLAN],
});
},
throwOnError: true,
});
};
1 change: 0 additions & 1 deletion src/hooks/apis/useToggleIsPublicMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ export const useToggleIsPublicMutation = (planId: number) => {
queryKey: [{ planId: planId }, QUERY_KEY.PLAN],
});
},
throwOnError: true,
});
};