-
Notifications
You must be signed in to change notification settings - Fork 1
✨ Feat: 마이도도 로그아웃 및 회원 탈퇴 기능 구현 #64
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
2023855
:sparkles: Feat: 로그아웃 API 함수 및 타입 정의
sooloin 20e56a9
:sparkles: Feat: 로그아웃 확인 모달 및 세션 정리 연동
sooloin 32edd33
:sparkles: Feat: 회원탈퇴 API 함수 및 타입 정의
sooloin faf1f15
:sparkles: Feat: 회원탈퇴 페이지 라우트 및 진입점 추가
sooloin 644833f
:sparkles: Feat: 회원탈퇴 인증 메일 발송 및 최종 탈퇴 플로우 구현
sooloin d50e02e
:sparkles: Feat: 회원탈퇴 완료 화면 구현
sooloin 6b88f4e
:bug: Fix: 로그아웃 실패 시에도 로컬 세션 정리 보장
sooloin 6ee34ca
:bug: Fix: 탈퇴 완료 모달 노출 전 세션 정리로 인한 리다이렉트 방지
sooloin d473d19
:bug: Fix: 쿨다운 타이머 효율화 및 OTP 입력 포커스 가드 추가
sooloin 2f454e7
:rocket: Chore: Vercel 재배포 트리거
sooloin a3c416a
:rocket: Chore: Vercel 재배포 트리거2
sooloin dbab353
:rocket: Chore: Vercel 재배포 트리거3
sooloin 916f94a
:rocket: Chore: Vercel 재배포 트리거3
sooloin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { useMutation } from '@tanstack/react-query'; | ||
|
|
||
| import { logout } from '@/features/auth/api/auth'; | ||
| import type { LogoutResponse } from '@/features/auth/model/types'; | ||
| import { getRefreshToken } from '@/shared/lib/auth/token'; | ||
|
|
||
| /** | ||
| * 로그아웃 (POST /auth/logout) | ||
| * - refreshToken이 없으면 서버 호출 없이 로컬 세션만 정리하도록 null 반환 | ||
| * - 토큰/캐시 정리·이동은 호출 측에서 처리 | ||
| */ | ||
| export function useLogout() { | ||
| return useMutation<LogoutResponse | null, unknown, void>({ | ||
| mutationFn: async () => { | ||
| const refreshToken = getRefreshToken(); | ||
| if (!refreshToken) return null; | ||
|
|
||
| return logout(refreshToken); | ||
| }, | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { useMutation } from '@tanstack/react-query'; | ||
|
|
||
| import { sendWithdrawalEmail } from '@/features/auth/api/users'; | ||
| import type { WithdrawalEmailResponse } from '@/features/auth/model/types'; | ||
|
|
||
| /** 탈퇴 인증 메일 발송 (POST /users/me/withdrawal/email) */ | ||
| export function useSendWithdrawalEmail() { | ||
| return useMutation<WithdrawalEmailResponse, unknown, void>({ | ||
| mutationFn: () => sendWithdrawalEmail(), | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { useMutation } from '@tanstack/react-query'; | ||
|
|
||
| import { withdrawUser } from '@/features/auth/api/users'; | ||
| import type { WithdrawUserResponse } from '@/features/auth/model/types'; | ||
|
|
||
| /** 최종 회원 탈퇴 (DELETE /users/me) — 메일로 받은 6자리 인증번호로 계정 삭제 */ | ||
| export function useWithdrawUser() { | ||
| return useMutation<WithdrawUserResponse, unknown, string>({ | ||
| mutationFn: (authCode) => withdrawUser(authCode), | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { useState } from 'react'; | ||
| import { Link } from 'react-router-dom'; | ||
|
|
||
| import { WithdrawalCompleteModal } from '@/pages/my/ui/WithdrawalCompleteModal'; | ||
| import { WithdrawalFlow } from '@/pages/my/ui/WithdrawalFlow'; | ||
|
|
||
| export function WithdrawalPage() { | ||
| const [completed, setCompleted] = useState(false); | ||
|
|
||
| // 토큰 정리는 완료 모달을 닫고 홈으로 이동하는 시점(WithdrawalCompleteModal)으로 미룬다. | ||
| // RequireAuth 가드 아래에서 즉시 clearTokens 하면 모달 노출 전에 /auth로 리다이렉트될 수 있다. | ||
| const handleCompleted = () => { | ||
| setCompleted(true); | ||
| }; | ||
|
|
||
| return ( | ||
| <div className="mx-auto w-full max-w-xl px-4 py-10 sm:py-14"> | ||
| <div className="mb-2"> | ||
| <Link | ||
| to="/my?menu=profile-edit" | ||
| className="text-sm text-neutral-500 underline-offset-2 hover:text-brand hover:underline" | ||
| > | ||
| ← 회원정보 수정으로 돌아가기 | ||
| </Link> | ||
| </div> | ||
|
|
||
| <div className="overflow-hidden rounded-[24px] border border-neutral-200 bg-white shadow-sm"> | ||
| <div className="border-b border-neutral-100 px-6 py-6 sm:px-8"> | ||
| <h1 className="text-[20px] font-semibold tracking-[-0.02em] text-neutral-950">회원 탈퇴</h1> | ||
| <p className="mt-2 text-sm leading-7 text-neutral-600"> | ||
| 탈퇴를 진행하려면 본인 확인이 필요해요. 가입하신 이메일로 인증번호를 보내드릴게요. | ||
| </p> | ||
| {/* <p className="text-sm leading-7 text-red-500">탈퇴 시 계정과 모든 데이터가 삭제되며 되돌릴 수 없어요.</p> */} | ||
| </div> | ||
|
|
||
| <div className="px-6 py-6 sm:px-8"> | ||
| <WithdrawalFlow onCompleted={handleCompleted} /> | ||
| </div> | ||
| </div> | ||
|
|
||
| <WithdrawalCompleteModal open={completed} /> | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
WithdrawalPage는RequireAuth가드로 보호되어 있습니다. 따라서handleCompleted에서 즉시clearTokens()를 호출하면 인증 상태가 해제되어,WithdrawalCompleteModal이 표시되기도 전에 로그인 페이지(/auth)로 강제 리다이렉트되는 UX 버그가 발생할 수 있습니다.토큰 삭제는 탈퇴 완료 모달을 닫고 홈으로 이동하는 시점(
WithdrawalCompleteModal내부)으로 미루는 것이 안전합니다.