Skip to content

Commit

Permalink
Chore: #146 코드리뷰에 따라 불필요한 코드 삭제 및 에러처리 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoonyesol committed Sep 25, 2024
1 parent f9ec533 commit 1254f3a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/pages/setting/UserAuthenticatePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@ function UserAuthenticatePage() {
onVerifyCode();
navigate('/setting/password', { replace: true });
} catch (error) {
if (error instanceof AxiosError && error.response) {
if (error.response.status === 401) toastError(error.response.data.message);
} else {
toastError('예상치 못한 에러가 발생했습니다.');
}
if (error instanceof AxiosError && error.response) toastError(error.response.data.message);
else toastError('예상치 못한 에러가 발생했습니다.');
}
};

Expand Down
3 changes: 1 addition & 2 deletions src/services/axiosProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const Interceptor = ({ children }: InterceptorProps) => {
const responseInterceptor = authAxios.interceptors.response.use(
(response) => response,
async (error) => {
const originalRequest = error.config;
const originalRequest = { ...error.config };

// 액세스 토큰 만료 시 처리
if (error.response?.status === 401 && !originalRequest.isRetry) {
Expand All @@ -66,7 +66,6 @@ export const Interceptor = ({ children }: InterceptorProps) => {
// TODO: 에러 응답 완성 후 리프레시 토큰 오류 감지 로직 수정
if (!errorMessage.includes('리프레시 토큰이 유효하지 않습니다.')) return Promise.reject(error);

if (originalRequest.isRetry) return;
originalRequest.isRetry = true;

try {
Expand Down

0 comments on commit 1254f3a

Please sign in to comment.