diff --git a/src/components/trip/ScheduleDetail.tsx b/src/components/trip/ScheduleDetail.tsx index 63ef3fa..27f4fa5 100644 --- a/src/components/trip/ScheduleDetail.tsx +++ b/src/components/trip/ScheduleDetail.tsx @@ -156,21 +156,52 @@ export default function ScheduleDetail({ scheduleId }: { scheduleId: string }) { } } - async function handleDelete() { - if (deleting || !window.confirm("이 일정을 삭제할까요?\n삭제한 일정은 복구할 수 없습니다.")) { - return; - } + function handleDelete() { + if (deleting) return; - setDeleting(true); - try { - await deleteSchedule(scheduleId); - toast.success("일정을 삭제했습니다."); - router.replace("/trips"); - router.refresh(); - } catch (cause) { - toast.error(cause instanceof Error ? cause.message : "일정을 삭제하지 못했습니다."); - setDeleting(false); - } + toast.custom( + (toastId) => ( +
+
+

일정을 삭제할까요?

+

삭제하면 되돌릴 수 없어요.

+
+
+ + +
+
+ ), + { duration: Infinity }, + ); } if (error) { @@ -220,7 +251,7 @@ export default function ScheduleDetail({ scheduleId }: { scheduleId: string }) { type="button" aria-label="일정 삭제" disabled={deleting} - onClick={() => void handleDelete()} + onClick={handleDelete} className="grid size-8 shrink-0 place-items-center rounded-full text-zinc-600 hover:bg-red-50 hover:text-red-500 disabled:cursor-wait disabled:opacity-50" >