diff --git a/fe/src/app/event-maps/[id]/components/PingInformation.tsx b/fe/src/app/event-maps/[id]/components/PingInformation.tsx
index dd89210..191b2b3 100644
--- a/fe/src/app/event-maps/[id]/components/PingInformation.tsx
+++ b/fe/src/app/event-maps/[id]/components/PingInformation.tsx
@@ -94,7 +94,49 @@ export default function PingInformaion() {
return null;
}
};
+ const deletePingApi = async () => {
+ try {
+ const token = localStorage.getItem("authToken");
+
+ const response = await fetch(
+ `${process.env.NEXT_PUBLIC_API_BASE_URL}/pings/member`,
+ {
+ method: "DELETE",
+ headers: {
+ Authorization: `Bearer ${token}`,
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ sid: selectedPing?.sid,
+ }),
+ }
+ );
+
+ if (!response.ok) {
+ if (response.status === 401) {
+ const errorResponse = await response.json();
+ if (errorResponse.subCode === 4) {
+ const newAccessToken = await reissueAccessToken(token);
+ if (newAccessToken) {
+ return await deletePingApi();
+ }
+ openLoginModal();
+ return null;
+ }
+ }
+ openLoginModal();
+ throw new Error(`HTTP error! status: ${response.status}`);
+ }
+ toggleTrigger();
+ setLastUpdated(Date.now());
+ console.log("삭제 성공");
+ return true;
+ } catch (error) {
+ console.error("삭제 중 오류 발생:", error);
+ return null;
+ }
+ };
const handleOpenLoginModal = () => {
sendPingApi();
console.log("Button clicked: Open login modal");
@@ -131,12 +173,14 @@ export default function PingInformaion() {
{isAlreadyPing ? (
-
+
) : (