From 33bed9b7cb89990bf61febafe4a66639933231c1 Mon Sep 17 00:00:00 2001 From: manNomi Date: Tue, 1 Sep 2026 23:25:06 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20=EC=95=B1=20=EB=82=B4=20?= =?UTF-8?q?=EA=B2=8C=EC=8B=9C=EA=B8=80=20=EC=82=AD=EC=A0=9C=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8=EC=B0=BD=20=EB=8F=99=EC=9E=91=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/apis/community/deletePost.ts | 3 ++ .../[boardCode]/[postId]/KebabMenu.tsx | 30 ++++++++++++++----- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/apps/web/src/apis/community/deletePost.ts b/apps/web/src/apis/community/deletePost.ts index 01ed96b1..7390a355 100644 --- a/apps/web/src/apis/community/deletePost.ts +++ b/apps/web/src/apis/community/deletePost.ts @@ -59,6 +59,9 @@ const useDeletePost = () => { // 게시글 목록 페이지 이동 router.replace(`/community/${variables.boardCode || "FREE"}`); }, + onError: () => { + showIconToast("logo", "게시글 삭제에 실패했습니다. 잠시 후 다시 시도해주세요."); + }, }); }; diff --git a/apps/web/src/app/community/[boardCode]/[postId]/KebabMenu.tsx b/apps/web/src/app/community/[boardCode]/[postId]/KebabMenu.tsx index 88ae377a..89dacbb6 100644 --- a/apps/web/src/app/community/[boardCode]/[postId]/KebabMenu.tsx +++ b/apps/web/src/app/community/[boardCode]/[postId]/KebabMenu.tsx @@ -7,6 +7,7 @@ import { useDeletePost } from "@/apis/community"; import useBlockCommunityUser from "@/app/community/_hooks/useBlockCommunityUser"; import ReportPanel from "@/components/ui/ReportPanel"; import { showIconToast } from "@/lib/toast/showIconToast"; +import { customConfirm } from "@/lib/zustand/useConfirmModalStore"; import { IconSetting } from "@/public/svgs/mentor"; const useClickOutside = (ref: RefObject, handler: (event: MouseEvent | TouchEvent) => void) => { @@ -52,7 +53,7 @@ type KebabMenuProps = { const KebabMenu = ({ postId, boardCode, isOwner = false, authorId }: KebabMenuProps) => { const dropdownRef = useRef(null); - const { mutate: deletePost } = useDeletePost(); + const { mutate: deletePost, isPending: isDeleting } = useDeletePost(); const router = useRouter(); const { handleBlockUser, isBlocking } = useBlockCommunityUser({ onBlocked: () => router.replace(`/community/${boardCode}`), @@ -77,6 +78,23 @@ const KebabMenu = ({ postId, boardCode, isOwner = false, authorId }: KebabMenuPr } }; + const handleDeletePost = async () => { + setIsDropdownOpen(false); + + const confirmed = await customConfirm({ + title: "게시글 삭제", + content: "삭제한 게시글은 복구할 수 없습니다.\n정말 삭제하시겠습니까?", + approveMessage: "삭제하기", + rejectMessage: "취소", + }); + + if (!confirmed) { + return; + } + + deletePost({ postId, boardCode }); + }; + return (