From 94d440416b6c85c62597eef2a8f97bf6fcbf998e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=84=9D=EC=B0=AC=20=EC=9C=A4?= <ysc0731@ajou.ac.kr>
Date: Tue, 10 Dec 2024 01:32:13 +0900
Subject: [PATCH] =?UTF-8?q?fix:=20meetin=20api=20method=20=EB=B0=8F=20cred?=
 =?UTF-8?q?entials=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/api/meeting.js | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/api/meeting.js b/src/api/meeting.js
index ff6fb6d..4ef7aba 100644
--- a/src/api/meeting.js
+++ b/src/api/meeting.js
@@ -11,6 +11,7 @@ export const getAllMeetings = async (page = 0, size = 20) => {
   const response = await fetch(
     `${BASE_URL}/api/meeting?page=${page}&size=${size}`,
     {
+      credentials: "include", // Include credentials for session-based authentication
       method: "GET",
     }
   );
@@ -29,6 +30,7 @@ export const getAllMeetings = async (page = 0, size = 20) => {
  */
 export const getMeetingDetails = async (meetingId) => {
   const response = await fetch(`${BASE_URL}/api/meeting/${meetingId}`, {
+    credentials: "include",
     method: "GET",
   });
 
@@ -46,6 +48,7 @@ export const getMeetingDetails = async (meetingId) => {
  */
 export const createMeeting = async (meetingData) => {
   const response = await fetch(`${BASE_URL}/api/meeting`, {
+    credentials: "include",
     method: "POST",
     headers: {
       "Content-Type": "application/json",
@@ -67,6 +70,7 @@ export const createMeeting = async (meetingData) => {
  */
 export const joinMeeting = async (meetingId) => {
   const response = await fetch(`${BASE_URL}/api/meeting/${meetingId}/join`, {
+    credentials: "include",
     method: "POST",
   });
 
@@ -87,6 +91,7 @@ export const getMyMeetings = async (page = 0, size = 20) => {
   const response = await fetch(
     `${BASE_URL}/api/meeting/my?page=${page}&size=${size}`,
     {
+      credentials: "include",
       method: "GET",
     }
   );
@@ -105,7 +110,8 @@ export const getMyMeetings = async (page = 0, size = 20) => {
  */
 export const leaveMeeting = async (meetingId) => {
   const response = await fetch(`${BASE_URL}/api/meeting/${meetingId}/leave`, {
-    method: "POST",
+    credentials: "include",
+    method: "DELETE",
   });
 
   if (!response.ok) {
@@ -122,6 +128,7 @@ export const leaveMeeting = async (meetingId) => {
  */
 export const closeMeeting = async (meetingId) => {
   const response = await fetch(`${BASE_URL}/api/meeting/${meetingId}/close`, {
+    credentials: "include",
     method: "PUT",
   });
 
@@ -132,8 +139,14 @@ export const closeMeeting = async (meetingId) => {
   return await response.json();
 };
 
+/**
+ * 미팅 삭제
+ * @param {number} meetingId - 삭제할 미팅 ID
+ * @returns {Promise<Object>} - 삭제 결과 메시지
+ */
 export const deleteMeeting = async (meetingId) => {
   const response = await fetch(`${BASE_URL}/api/meeting/${meetingId}`, {
+    credentials: "include",
     method: "DELETE",
   });
 
-- 
GitLab