[refactor] API 오류 정규화 및 인증 오류 처리 개선 - #20
Merged
Merged
Conversation
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
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.
개요 💡
기존
AdminLayout에서는useGetMyInfo요청이 실패하면 오류 원인을 구분하지 않고 모든 경우를 로그인 만료로 처리하고 있었습니다.이로 인해 서버 오류, 네트워크 오류, Zod 응답 검증 오류처럼 인증과 관계없는 문제에서도 Query Cache와 인증 토큰이 삭제되고 로그인 페이지로 이동할 수 있었습니다.
이에 Axios 오류와 Zod 검증 오류를 공통
AppError로 정규화하고, 실제 인증 오류에서만 세션을 정리하도록 오류 처리 구조를 개선했습니다.작업내용 ⌨️
AppError정의normalizeApiError를 통해 공통 오류 형태로 변환message를 유지하고, 메시지가 없는 경우 기본 안내 문구를 사용하도록 처리AppError로 정규화AdminLayout에서AUTHENTICATION오류인 경우에만 Query Cache와 인증 토큰 삭제clearAuthSession으로 공통화retry: false를 확인하고 유지개선 결과 ⚙️
cause에 유지해 HTTP 상태 코드와 Zod 검증 실패 경로 추적 가능