[#37] Feat/37/마이페이지 - #41
Merged
Hidden character warning
The head ref may contain hidden characters: "Feat/37/\ub9c8\uc774\ud398\uc774\uc9c0"
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
❓이슈
📝 Description
/mypage페이지 반응형 구현 및 프로필·비밀번호 변경 API 연동크게 프로필 변경 섹션과 비밀번호 변경 섹션으로 나뉘며,
각 섹션에 필요한 API 레이어(
file,user)도 함께 작성했습니다.작업 중 발견된 드롭다운 버그와 헤더 z-index 이슈도 함께 수정했습니다.
/api/v1/files?type=PROFILEfileId반환/api/v1/users/me/profile-image/api/v1/users/me/api/v1/users/me/password🗂️ 구현 상세
1. 공통 에러 처리 —
apiError.tsfetch가!res.ok일 때status를 담은ApiError를 throw하고,catch (err: unknown)블록에서isApiError(err)로 타입을 좁혀 에러 코드별 분기 처리합니다.any타입 없이 타입 안전하게 에러를 다룰 수 있도록 설계했습니다.2. 파일 업로드 플로우
파일 선택 → POST /api/v1/files?type=PROFILE
→ fileId 반환
→ PATCH /api/v1/users/me/profile-image { fileId }
type=PROFILE일 때는workspaceId없이 요청합니다. 추후 영수증 업로드 시type=RECEIPT,workspaceId전달만으로 동일 함수를 재사용할 수 있도록 설계했습니다.3. 저장 버튼 활성화 조건
4. 프로필 저장 시 동시 요청
두 요청 중 하나라도 실패하면 해당 에러 토스트만 표시하고, 나머지 성공한 요청은 유지됩니다.
5. 저장 성공 후 즉시 갱신
invalidateQueries로useGetMe()캐시를 무효화해 헤더의HeaderUserProfile(이름·이미지)이 새로고침 없이 즉시 갱신됩니다.6. 이름·이미지 초기값 동기화
useSession()대신useGetMe()를 기준으로useEffect에서 초기화합니다.invalidateQueries후useGetMe()가 최신 데이터를 다시 받아오면 effect가 재실행되어 저장 후 이름·이미지가 자동으로 업데이트됩니다.7. 비밀번호 변경 에러 처리
새 비밀번호가 일치하지 않습니다.현재 비밀번호가 일치하지 않습니다.비밀번호는 영문, 숫자, 특수문자 포함 6자 이상입니다.비밀번호 변경에 실패했습니다.8. 버그 수정
드롭다운 닫힘 순서
onSelect호출 전에setOpen(false)를 먼저 실행하도록 순서를 변경했습니다. 기존에는router.push()호출 후 컴포넌트가 언마운트되면서setOpen이 무시되어 특정 페이지에서 드롭다운이 닫히지 않는 문제가 있었습니다.헤더 z-index
header에z-10을 추가해Image컴포넌트의 stacking context 위로 올라오도록 수정했습니다.HeaderUserProfile 드롭다운 경로 변경 시 닫힘
key={pathname}을 사용해 경로가 변경될 때 컴포넌트를 리마운트시켜openstate가false로 초기화되도록 했습니다.🌀 PR Type
어떤 변경 사항이 있나요?
✅ Checklist
PR Checklist
PR이 다음 요구 사항을 충족하는지 확인하세요.
Test Checklist