diff --git a/src/app/(pages)/mypage/my-4q/_components/item-list.tsx b/src/app/(pages)/mypage/my-4q/_components/item-list.tsx index 262e308..1dfbc4e 100644 --- a/src/app/(pages)/mypage/my-4q/_components/item-list.tsx +++ b/src/app/(pages)/mypage/my-4q/_components/item-list.tsx @@ -45,10 +45,16 @@ const ItemList = ({ item }) => { }; const handleOk = async () => { - await deleteTicket(item.id); - message.success("티켓이 삭제되었습니다."); - setIsModalOpen(false); + try { + await deleteTicket(item.id); + message.success("티켓이 삭제되었습니다."); + setIsModalOpen(false); + } catch (error) { + message.error("티켓 삭제에 실패했습니다."); + console.error(error); + } }; + const handleCancel = () => { setIsModalOpen(false); diff --git a/src/app/(pages)/mypage/page.module.css b/src/app/(pages)/mypage/page.module.css index 8bdf95a..a4a61ee 100644 --- a/src/app/(pages)/mypage/page.module.css +++ b/src/app/(pages)/mypage/page.module.css @@ -73,6 +73,14 @@ font-size: 20px; } +.linkText { + display: flex; + flex-direction: row; + align-items: center; + /* flex-direction: column; */ +} + + .profileEditBtn { background-color: #000; margin-top: 12px; diff --git a/src/service/photo_api.ts b/src/service/photo_api.ts index 235ef21..8ba1f6d 100644 --- a/src/service/photo_api.ts +++ b/src/service/photo_api.ts @@ -229,17 +229,22 @@ export const getLikedTicket = async() => { } }; -export const deleteTicket = async(ticketId: number) => { +// 티켓 삭제 +export const deleteTicket = async (ticketId: number) => { const token = sessionStorage.getItem('AccessToken'); try { const response = await fetch(`${BASE_URL}/ticket/${ticketId}`, { - method: "DELETE", - headers: { - "Authorization": `Bearer ${token}`, - "Content-Type": "application/json", - }, + method: "DELETE", + headers: { + "Authorization": `Bearer ${token}`, + "Content-Type": "application/json", + }, }); -} catch (error) { + + if (!response.ok) { + throw new Error("Failed to delete ticket"); + } + } catch (error) { throw error; -} -}; \ No newline at end of file + } +};