Skip to content

Commit

Permalink
chore: axios에 notFound 분기 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
hanyugeon committed Jul 30, 2024
1 parent 2e64603 commit 78bc6a7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
6 changes: 0 additions & 6 deletions src/apis/core/axios.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { notFound } from 'next/navigation';
import axios, { CreateAxiosDefaults, InternalAxiosRequestConfig } from 'axios';

import { AuthRefreshIgnoredError } from '@/types/customError';
Expand All @@ -7,7 +6,6 @@ import {
isAuthFailedError,
isAuthRefreshError,
isAxiosErrorWithCustomCode,
isNotFoundError,
} from '@/utils/helpers';
import { deleteAuthSession, setAuthSession } from '@/server/session';
import { deleteCookie } from '@/utils/cookie';
Expand Down Expand Up @@ -43,10 +41,6 @@ const responseHandler = async (error: unknown) => {

console.warn(code, message);

if (isNotFoundError(code)) {
notFound();
}

if (originRequest && isAuthRefreshError(code)) {
return silentRefresh(originRequest);
}
Expand Down
9 changes: 1 addition & 8 deletions src/utils/helpers/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ const isAuthFailedError = (code: ServiceErrorCode) =>

const isAuthRefreshError = (code: ServiceErrorCode) => code === 'A4';

const isNotFoundError = (code: ServiceErrorCode) => code === 'C1';

/** axios 에러 응답에 custom error code가 포함되어 있는지 확인하며, 이를 보장하는 타입 가드 함수입니다. */
const isAxiosErrorWithCustomCode = (
error: unknown
Expand All @@ -30,9 +28,4 @@ const isAxiosErrorWithCustomCode = (
);
};

export {
isAuthFailedError,
isAuthRefreshError,
isNotFoundError,
isAxiosErrorWithCustomCode,
};
export { isAuthFailedError, isAuthRefreshError, isAxiosErrorWithCustomCode };

0 comments on commit 78bc6a7

Please sign in to comment.