Skip to content

Comments

[CHORE] 탈퇴하기 추가 / refresh#92

Merged
Emithen merged 3 commits intodevelopfrom
chore/#91/sign-out
Jan 19, 2026
Merged

[CHORE] 탈퇴하기 추가 / refresh#92
Emithen merged 3 commits intodevelopfrom
chore/#91/sign-out

Conversation

@Emithen
Copy link
Collaborator

@Emithen Emithen commented Jan 18, 2026

📝 요약

  • 탈퇴하기 추가 / refresh

✅ 작업 내용

  • 탈퇴하기 추가
  • 권한이 없는 댓글에 대한 조작 UI 노출 숨김
  • 댓글 삭제 이후 refresh

🧪 테스트 방법

  • 관리자 계정으로 댓글 삭제 시도하고 관리자 도구 네트워크 탭에서 commets fetch 발생하는지 확인하기

📷 참고 자료 (스크린샷/링크/GIF 등)

🔬 관련 이슈

☝️ 참고 사항

  • 참고하세요~

Summary by CodeRabbit

릴리스 노트

  • 새 기능

    • 계정 탈퇴 기능 추가 (마이페이지 계정 관리 섹션)
  • 버그 수정

    • 댓글 관리 옵션 메뉴에 접근 제어 추가 - 관리자 및 댓글 작성자만 표시
    • 투표 삭제 후 네비게이션 동작 개선

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link
Contributor

vercel bot commented Jan 18, 2026

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

Project Deployment Review Updated (UTC)
valanse-origin-repo Ready Ready Preview Jan 18, 2026 8:57am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 18, 2026

Walkthrough

탈퇴하기 기능과 역할 기반 댓글 삭제 권한, 새로운 데이터 새로고침 패턴을 구현합니다. API 레이어에 새로운 signout 엔드포인트 호출 함수를 추가하고, Redux thunk를 통해 토큰 초기화를 처리하며, 계정 설정 UI에 탈퇴 버튼을 추가합니다. 댓글 상세 컴포넌트는 사용자 프로필 정보를 수신하여 관리자 또는 작성자만 삭제 메뉴를 볼 수 있도록 제한합니다.

Changes

코호트 / 파일 변경 요약
API 및 상태 관리 레이어
src/api/auth.ts, src/store/thunks/authThunks.ts
/auth/withdraw 엔드포인트로 POST 요청을 수행하는 새로운 signout 함수 추가; signoutThunk 추가로 API 호출 시 토큰 초기화 및 로그아웃 상태 업데이트
계정 설정 UI
src/components/pages/my/accountControlSection.tsx
기존 로그아웃 컨테이너를 버튼 요소로 변경; 새로운 "탈퇴하기" 버튼 추가로 signoutThunk 디스패치
댓글 상세 및 권한 관리
src/components/pages/poll/Comment/commentDetail.tsx
profile prop 추가; 삭제 메뉴 버튼을 조건부 렌더링 (관리자 또는 작성자만 표시); 삭제 후 fetchComments로 댓글 목록 새로고침
페이지 네비게이션
src/app/poll/[id]/page.tsx
투표 삭제 후 히스토리 이동(router.back())에서 고정 경로(router.push('/balanse'))로 변경; CommentDetail 컴포넌트에 profile prop 전달

Sequence Diagram

sequenceDiagram
    participant User
    participant UI as accountControlSection
    participant Redux as Redux Store
    participant API as Auth API
    participant Server as Server

    User->>UI: 탈퇴하기 버튼 클릭
    UI->>Redux: handleSignout() dispatch(signoutThunk())
    Redux->>API: signoutThunk 시작
    API->>Server: POST /auth/withdraw
    Server-->>API: 성공 응답
    API->>Redux: dispatch logout()
    Redux->>Redux: 토큰 초기화, 사용자 상태 제거
    Redux-->>UI: 상태 업데이트 완료
    UI-->>User: 탈퇴 완료, 리다이렉트
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly Related PRs

  • [Feature] #38/mypage #42: 인증 API, thunk, 계정 UI의 로그아웃/탈퇴 흐름 추가로 동일한 auth 파일 및 Redux 상태 관리 구조를 수정합니다.
  • 바텀탭 링크 수정 및 댓글 삭제 #56: 댓글 삭제 로직과 UI를 구현하여 commentDetail.tsx의 삭제 메뉴 및 데이터 갱신 방식을 변경합니다.
  • 복구 #66: src/app/poll/[id]/page.tsx의 네비게이션 동작을 조정하여 뒤로 가기 처리 방식을 수정합니다.

Poem

🐰 탈퇴의 길을 열었고,
권한의 담장을 세워,
데이터는 새로이 피어나네.
버튼 하나, 토큰 사라지고,
댓글의 주인만 삭제 권한 가져가네. ✨

🚥 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의 주요 변경사항인 탈퇴하기 기능 추가와 새로고침 처리를 명확하게 요약하고 있습니다.
Linked Issues check ✅ Passed PR은 연결된 이슈 #91의 모든 코딩 요구사항을 충족합니다: 탈퇴하기 버튼 작동, 댓글 삭제 후 새로고침, 비관리자 댓글 조작 UI 숨김.
Out of Scope Changes check ✅ Passed 모든 변경사항이 이슈 #91의 요구사항과 직접 관련되어 있으며, 범위를 벗어난 변경은 없습니다.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/components/pages/my/accountControlSection.tsx`:
- Around line 11-13: Add a confirmation modal and error handling around the
irreversible sign-out flow: replace the direct dispatch in handleSignout with an
async function that shows a loading state, dispatches signoutThunk inside
try/catch, closes the ConfirmModal (showConfirmModal) on success and surfaces
errors (via local error state or an existing toast/logger) on failure; add
component state (showConfirmModal) and wire the "탈퇴하기" button to
setShowConfirmModal(true) while disabling it when isLoading, and render
ConfirmModal with props open={showConfirmModal}, onClose={() =>
setShowConfirmModal(false)}, and onConfirm={handleSignout}; ensure you reference
handleSignout, signoutThunk, showConfirmModal, setShowConfirmModal, isLoading,
and ConfirmModal so the changes are easy to locate.
🧹 Nitpick comments (1)
src/components/pages/poll/Comment/commentDetail.tsx (1)

35-35: profile prop이 필수인지 선택인지 명확히 해주세요.

현재 profile: Profile로 선언되어 있어 필수 prop입니다. 하지만 기존 comments, voteId, onClose는 optional(?)입니다. 일관성을 위해 확인이 필요합니다.

만약 profile이 없는 상황(비로그인 등)을 고려해야 한다면 optional로 변경하고 조건부 렌더링이 필요합니다.

try {
await authApi.post('/auth/withdraw')
} catch (error) {
throw error
Copy link
Collaborator

Choose a reason for hiding this comment

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

이거 받아주는 곳 있나요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

이거 받아주는 곳 있나요?

srt/store/thunks/authThunks.ts -> 여기 thunk 단에서 받아줍니다. 근데 아직 redux thunk 계층 예외 처리 전략이 없어서 딱히 뭘 하고 있진 않음.

try {
await deleteVote(data.voteId)
setDeleteModalOpen(false)
router.back()
Copy link
Collaborator

Choose a reason for hiding this comment

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

왜.. 왜 백이었죠

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

왜.. 왜 백이었죠

플로우가 게시글 클릭 -> 삭제 이거밖에 없는 줄 알았는데, 생성 페이지 -> 삭제도 있어가지고 바꿨습니다.

@Emithen Emithen merged commit 23976c4 into develop Jan 19, 2026
4 checks passed
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.

[CHORE] 탈퇴하기 / refresh

2 participants