Skip to content

refactor(mypage): 마이페이지 api 에러처리 리팩토링 및 scroll 이슈 수정#351

Merged
sohyun0 merged 6 commits into
developfrom
#295-refactor-mypage
Apr 29, 2026
Merged

refactor(mypage): 마이페이지 api 에러처리 리팩토링 및 scroll 이슈 수정#351
sohyun0 merged 6 commits into
developfrom
#295-refactor-mypage

Conversation

@sohyun0
Copy link
Copy Markdown
Contributor

@sohyun0 sohyun0 commented Apr 23, 2026

🛠️ 설명 (Description)

마이페이지 api 에러처리 및 에러 메세지 노출 방식을 일관성 있도록 변경하고
scroll 시 탭 영역으로 강제이동 되는 이슈 수정

📝 변경 사항 요약 (Summary)

  • utils/api.ts : status 별 에러메세지를 커스텀 할 수 있도록 확장
  • mypage/TabWrapper: scroll 시 탭 영역으로 강제이동 되는 이슈 수정 및 트러블슈팅 노션작성
  • 주석 위치 변경하여 함수에 jsdoc 이 출력되도록 변경

💁 변경 사항 이유 (Why)

  • utils/api.ts에서 options 추가한 이유는 백엔드에서 전달해준 에러값을 그대로 사용 하되 일부 코드만 커스텀 메세지를 출력하고 싶을때 사용하기 위함

✅ 테스트 계획 (Test Plan)

  • api.test.ts 에서 유닛테스트 통과완료 했습니다.
  • 관련 테스트는 statusMessages에 해당 status가 있으면 응답 바디 message보다 우선한다 항목입니다.

🔗 관련 이슈 (Related Issues)

☑️ 체크리스트 (Checklist)

  • 코드가 프로젝트 코딩 컨벤션을 따릅니다.
  • 테스트 코드가 작성되었고, 통과했습니다.
  • 변경 사항에 대한 문서화가 완료되었습니다.
  • 필요한 경우, 다른 팀원에게 리뷰를 요청했습니다.
  • CI/CD 파이프라인이 성공했습니다.

👀 리뷰어를 위한 참고 사항 (Notes for Reviewers)

➕ 추가 정보 (Additional Information)

@sohyun0 sohyun0 self-assigned this Apr 23, 2026
@sohyun0 sohyun0 added fix 버그 수정 refactor 코드 리팩토링 / 코드 수정 labels Apr 23, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the MyPage feature by centralizing success and error messages into a dedicated constants file and enhancing the throwApiError utility to support status-specific overrides. It also improves the tab scrolling logic in TabWrapper and updates various hooks to use centralized API calls. The review feedback focuses on improving the consistency and safety of error handling across all mutations by utilizing the getUserErrorMessage utility instead of directly accessing error.message, which ensures a fallback message is provided if the error object is malformed.

Comment thread features/mypage/mutations.ts Outdated
onError: (error) => {
handleShowToast({
message: "프로필 수정에 실패했습니다.\n잠시 후 다시 시도해주세요.",
message: error.message,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

에러 처리의 일관성과 안전성을 위해 error.message를 직접 사용하는 대신, useUploadProfileImage에서와 같이 getUserErrorMessage 유틸리티를 사용하는 것이 좋습니다. 이는 네트워크 에러 등 Error 객체가 아닌 예외가 발생했을 때 런타임 에러를 방지하고, 정의된 폴백 메시지를 안전하게 보여줄 수 있게 합니다. 이 파일 내의 다른 onError 핸들러들에도 동일한 패턴을 적용해 주세요.

Suggested change
message: error.message,
message: getUserErrorMessage(error, MYPAGE_MESSAGES.updateProfileError),

Comment thread features/mypage/mutations.ts Outdated
Comment thread features/mypage/mutations.ts Outdated
Comment thread features/mypage/mutations.ts Outdated
Comment thread features/mypage/mutations.ts Outdated
Comment thread features/mypage/mutations.ts Outdated
Comment thread features/mypage/mutations.ts Outdated
@github-actions
Copy link
Copy Markdown

🧷 Preview: https://reboot-f8szwl9se-code-base.vercel.app
⏰ 배포 시각: 2026년 04월 23일 17시 49분

@github-actions
Copy link
Copy Markdown

🧷 Preview: https://reboot-mrilsc908-code-base.vercel.app
⏰ 배포 시각: 2026년 04월 23일 17시 55분

@sohyun0 sohyun0 merged commit bf9592b into develop Apr 29, 2026
1 check passed
@sohyun0 sohyun0 deleted the #295-refactor-mypage branch April 29, 2026 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix 버그 수정 refactor 코드 리팩토링 / 코드 수정

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] 마이페이지 api 변경 및 리팩토링

1 participant