-
Notifications
You must be signed in to change notification settings - Fork 1
그룹 생성 API 연결 #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
그룹 생성 API 연결 #48
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,20 +36,32 @@ export default function GroupPage() { | |
| description: string; | ||
| }) => { | ||
| try { | ||
| // 디버깅: 요청 전 데이터 확인 | ||
| console.log("📤 보내는 데이터:", { | ||
| name: data.name, | ||
| meetingName: data.category ?? "", // undefined 방지 | ||
| maxMembers: Number(data.totalMembers), // 숫자로 강제 변환 | ||
| password: "1234", | ||
| description: data.description, | ||
| }); | ||
|
|
||
| const response = await createStudy({ | ||
| name: data.name, | ||
| meetingName: data.category ?? "", // undefined 방지 | ||
| maxMembers: Number(data.totalMembers), // number 강제 변환 | ||
| password: "1234", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| description: data.description, | ||
| }); | ||
|
Comment on lines
+39
to
54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove debug logging and hard‑coded password from group creation payload This block both logs the outgoing payload and hard‑codes the group console.log("📤 보내는 데이터:", { ... password: "1234", ... });
const response = await createStudy({
name: data.name,
meetingName: data.category ?? "",
maxMembers: Number(data.totalMembers),
password: "1234",
description: data.description,
});Two issues:
Before merging to main, I’d (a) remove or dev‑gate this log and (b) either take 🤖 Prompt for AI Agents |
||
|
|
||
| // API 응답을 StudyGroup 형식으로 변환 | ||
| const newGroup: StudyGroup = { | ||
| id: response.id, // UUID 그대로 사용 | ||
| category: data.category, // 모달에서 입력받은 모임명 | ||
| title: response.name, | ||
| id: response.id, // UUID | ||
| category: data.category, // 사용자가 입력한 모임명 유지 | ||
| title: response.name, // 백엔드 name 사용 | ||
| leader: "나", // 생성자는 자동으로 스터디장 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| totalMembers: data.totalMembers, // 모달에서 입력받은 인원수 | ||
| totalMembers: response.maxMembers, // ⚠️ 서버 응답값 사용 | ||
| currentMembers: 1, // 생성자 포함 | ||
| createdAt: response.createdAt, // 생성일시 저장 (정렬용) | ||
| createdAt: response.createdAt, // 백엔드 createdAt | ||
| }; | ||
|
|
||
| setStudyGroups((prev) => [...prev, newGroup]); | ||
|
|
@@ -60,6 +72,7 @@ export default function GroupPage() { | |
| alert("스터디 생성 중 오류가 발생했습니다."); | ||
| } | ||
| }; | ||
|
|
||
|
|
||
| // 정렬 적용된 배열 (createdAt 우선, 없으면 id 기준) | ||
| const sortedGroups = [...studyGroups].sort((a, b) => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,16 +8,18 @@ import type { | |
|
|
||
| /** | ||
| * 스터디 생성 API | ||
| * @param data 스터디 생성 요청 데이터 (name, description) | ||
| * @param data 스터디 생성 요청 데이터 (name, meetingName, maxMembers, password, description) | ||
| * @returns 생성된 스터디 정보 | ||
| */ | ||
| export async function createStudy( | ||
| data: CreateStudyRequest | ||
| ): Promise<CreateStudyResponse> { | ||
| console.log("📤 실제 요청 바디:", data); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| const response = await api.post<CreateStudyResponse>("/studies", data); | ||
| return response.data; | ||
| } | ||
|
Comment on lines
+11
to
20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid logging full
🤖 Prompt for AI Agents |
||
|
|
||
|
|
||
| /** | ||
| * 초대 코드로 스터디 정보 조회 API | ||
| * 인증 불필요한 공개 API이므로 별도 인스턴스 사용 | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,8 @@ | ||||||
| { "rewrites": | ||||||
| [ | ||||||
| { | ||||||
| "source": "/api/:path*", | ||||||
| "destination": "http://3.27.86.20:8080/api/:path*" | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Vercel rewrite 설정에 보안 및 유지보수 관련 문제가 있습니다.
Suggested change
|
||||||
| } | ||||||
| ] | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
디버깅을 위한
console.log구문은 프로덕션 코드에 포함되어서는 안 됩니다. 머지하기 전에 제거해주세요.