Skip to content

Commit

Permalink
Merge pull request #159 from CoolPeace-yanolza/feature/#158
Browse files Browse the repository at this point in the history
[#158] axios instance 에러 처리 제거
  • Loading branch information
dabin-Hailey authored Jan 28, 2024
2 parents c91ed9f + da81658 commit 97dad12
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/api/lib/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const onResponse = (response: AxiosResponse): AxiosResponse => {
const onErrorResponse = async (error: AxiosResponseError<string>) => {
const { config, response } = error;

// 액세스 토큰이 만료되었을 때
if (response && response.status === 401) {
// 액세스 토큰이 만료되었을 때
if (error.response.data.code === 'JWT_EXPIRED_AUTHORIZATION') {
const originalRequest = config;

Expand Down Expand Up @@ -69,21 +69,10 @@ const onErrorResponse = async (error: AxiosResponseError<string>) => {
deleteAllCookies();
window.location.replace('/login');
}
} else {
// 액세스 토큰이 만료 이외의 모든 인증 에러 처리
console.log(error.response.data.code, error.response);
alert('서버에서 인증 오류가 발생했습니다.\n다시 로그인해주세요.');
await postLogout();
deleteAllCookies();
window.location.replace('/login');
}
} else {
console.log(error.response.data.code, error.response);
alert('서버에서 인증 오류가 발생했습니다.\n다시 로그인해주세요.');
await postLogout();
deleteAllCookies();
window.location.replace('/login');
}
console.log('response error : ', error);
};

// 요청 인터셉터 추가
Expand Down

0 comments on commit 97dad12

Please sign in to comment.