Skip to content

마이페이지 계정 탈퇴 API 연동#701

Merged
HA-SEUNG-JEONG merged 2 commits into
developfrom
fix/withdrawal
May 26, 2026
Merged

마이페이지 계정 탈퇴 API 연동#701
HA-SEUNG-JEONG merged 2 commits into
developfrom
fix/withdrawal

Conversation

@HA-SEUNG-JEONG

@HA-SEUNG-JEONG HA-SEUNG-JEONG commented May 26, 2026

Copy link
Copy Markdown
Contributor

Problem

마이페이지 > 프로필의 '계정 탈퇴' 버튼은 UI만 존재하고 실제 API 연동이 없었음. 탈퇴하기 클릭 시 아무런 동작이 발생하지 않는 상태.

Solution

DELETE /api/v6/mypage/class/withdraw 엔드포인트를 연동. 탈퇴 성공 시 clearClientAuthStateAndRedirect('/') 호출로 모든 클라이언트 상태(쿠키, Zustand 스토어, QueryCache)를 초기화하고 랜딩 페이지로 리다이렉트.

에러 핸들링은 useMutation 레벨 onError에 정의 — call-time 콜백 방식은 MutationCache.onError global 핸들러가 suppress되지 않아 에러 토스트가 2번 표시되는 문제가 있어 hook 레벨에서 처리.

Changes

Features

File Description
src/hooks/queries/user/use-withdraw-member-mutation.ts 계정 탈퇴 mutation hook 신규 추가
src/app/(service)/(my)/my-page/_components/withdrawal-confirm-modal.tsx mutation 연동, isPending 중 취소/탈퇴 버튼 disabled 처리

Result

  • 마이페이지 > 프로필 하단 '계정 탈퇴' → 안내 모달 → '탈퇴하기' 클릭 시 실제 탈퇴 API 호출
  • 성공: 모든 세션 상태 초기화 후 / 리다이렉트
  • 실패: 에러 토스트 1회 표시, 모달 유지 (재시도 가능)
  • API 호출 중 취소/탈퇴 버튼 모두 비활성화 → 중복 요청 및 실수로 인한 취소 방지

Test plan

  • 마이페이지 > 프로필 > '계정 탈퇴' 버튼 클릭 → 안내 모달 표시 확인
  • 탈퇴하기 클릭 → 로딩 중 버튼 텍스트 '탈퇴 중...' 및 취소/탈퇴 버튼 비활성화 확인
  • 탈퇴 성공 → 랜딩(/) 리다이렉트, 로그인 상태 해제 확인
  • 탈퇴 실패 시 에러 토스트 1개만 표시, 모달 유지 확인

🤖 Generated with Claude Code

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 회원 탈퇴 기능 구현 완료 - 사용자는 이제 마이페이지에서 서비스 탈퇴 가능
  • 버그 수정

    • 탈퇴 확인 모달 로직 개선 - 로딩 상태 표시 및 에러 처리 추가
    • 탈퇴 중일 때 중복 요청 방지를 위해 버튼 비활성화
    • 탈퇴 실패 시 사용자에게 오류 메시지 표시

Review Change Stack

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented May 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
study-platform-client-dev Error Error May 26, 2026 3:47am

@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@HA-SEUNG-JEONG, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 23 minutes and 27 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 51841741-57dc-4c16-8d3b-32004886caee

📥 Commits

Reviewing files that changed from the base of the PR and between 06816c3 and e2195ec.

📒 Files selected for processing (1)
  • src/hooks/queries/user/use-withdraw-member-mutation.ts
📝 Walkthrough

요약

탈퇴 모달에서 미완성 TODO 로직을 실제 useWithdrawMemberMutation 훅 호출로 교체하고, 취소 및 탈퇴 버튼 상태를 isPending에 연동하여 로딩 중 상태를 표시합니다.

변경 사항

회원 탈퇴 플로우 구현

Layer / File(s) 설명
탈퇴 뮤테이션 훅
src/hooks/queries/user/use-withdraw-member-mutation.ts
탈퇴 API 요청을 React Query mutation으로 처리하고, 성공 시 인증 상태를 정리한 후 랜딩 페이지로 리다이렉트하며, 실패 시 오류 토스트를 표시합니다.
탈퇴 모달 컴포넌트 통합
src/app/(service)/(my)/my-page/_components/withdrawal-confirm-modal.tsx
모달이 useWithdrawMemberMutation 훅을 호출하고, isPending 상태로 버튼을 비활성화하며 탈퇴 중 레이블을 동적으로 표시합니다.

관련 PR

🐰 탈퇴 버튼이 이제 제대로 일하네요
API 호출에 로딩 상태까지
성공하면 랜딩으로 쌩~ 리다이렉트
오류 나면 토스트로 정중히 알려줘요
완성된 회원 탈퇴 기능! 🎉

🎯 2 (Simple) | ⏱️ ~10분

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 변경 내용의 핵심을 명확하게 반영합니다. '마이페이지 계정 탈퇴 API 연동'은 새로운 useWithdrawMemberMutation 훅 추가와 탈퇴 모달의 API 연결이라는 주요 변경사항을 정확하게 설명합니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/withdrawal

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/hooks/queries/user/use-withdraw-member-mutation.ts`:
- Around line 18-19: The onError in use-withdraw-member-mutation.ts currently
calls showToast directly; change it to delegate to the centralized error handler
in utils/error-handler.ts instead. Update the onError signature to accept the
error parameter and call the exported handler (e.g., handleError or the
project’s error handler function) passing the error so the handler can use
useToastStore; remove the direct showToast usage and any hardcoded message so
all toast/message logic flows through utils/error-handler.ts.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8a000b77-e325-4173-bdf5-817156b08fef

📥 Commits

Reviewing files that changed from the base of the PR and between 2b5c1dd and 06816c3.

📒 Files selected for processing (2)
  • src/app/(service)/(my)/my-page/_components/withdrawal-confirm-modal.tsx
  • src/hooks/queries/user/use-withdraw-member-mutation.ts

Comment on lines +18 to +19
onError: () => {
showToast('탈퇴에 실패했습니다. 잠시 후 다시 시도해주세요.', 'error');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

에러 처리를 utils/error-handler.ts 경유로 통일해 주세요.

현재 onError에서 토스트를 직접 호출하고 있어 공통 에러 처리 경로를 우회합니다. 이 훅도 에러 핸들러 유틸을 통해 토스트/메시지 처리를 위임하는 형태로 맞춰 주세요.

As per coding guidelines, "All errors must be handled via utils/error-handler.ts — never use alert(), always use useToastStore."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/hooks/queries/user/use-withdraw-member-mutation.ts` around lines 18 - 19,
The onError in use-withdraw-member-mutation.ts currently calls showToast
directly; change it to delegate to the centralized error handler in
utils/error-handler.ts instead. Update the onError signature to accept the error
parameter and call the exported handler (e.g., handleError or the project’s
error handler function) passing the error so the handler can use useToastStore;
remove the direct showToast usage and any hardcoded message so all toast/message
logic flows through utils/error-handler.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@HA-SEUNG-JEONG HA-SEUNG-JEONG merged commit 1f4ec85 into develop May 26, 2026
9 of 11 checks passed
@HA-SEUNG-JEONG HA-SEUNG-JEONG deleted the fix/withdrawal branch May 26, 2026 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant