From d9c7501ce59520b5473341628ab68a4dff6bc218 Mon Sep 17 00:00:00 2001 From: asdf-qwe Date: Thu, 20 Nov 2025 17:27:18 +0900 Subject: [PATCH] =?UTF-8?q?fe/fix/99=20-=20=EC=B9=B4=ED=85=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=20=EC=82=AD=EC=A0=9C=20=EC=9D=91=EB=8B=B5=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../category/service/categoryService.ts | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/frontend/src/features/category/service/categoryService.ts b/frontend/src/features/category/service/categoryService.ts index db2a3fd..e26595b 100644 --- a/frontend/src/features/category/service/categoryService.ts +++ b/frontend/src/features/category/service/categoryService.ts @@ -87,7 +87,25 @@ export const categoryService = { } ); - const result: ApiResponse = await response.json(); + // 404 에러 확인 + if (response.status === 404) { + throw new Error("카테고리를 찾을 수 없습니다."); + } + + // 응답이 비어있는지 확인 + const text = await response.text(); + + // 빈 응답이면 성공으로 처리 + if (!text || text.trim() === "") { + if (response.ok) { + return "카테고리가 성공적으로 삭제되었습니다."; + } else { + throw new Error("카테고리 삭제에 실패했습니다."); + } + } + + // JSON 응답 파싱 + const result: ApiResponse = JSON.parse(text); if (!result.success) { throw new Error(result.message);