Skip to content

Commit 340f350

Browse files
committed
fix: reissue 에러 시 에러 처리 안되는 문제 해결
- client.ts의 interceptors.response.use 구문 내에서 api 호출및 데이터 가공을 함수 밖으로 꺼냄
1 parent 0bd30f4 commit 340f350

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/apis/client.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,8 @@ client.interceptors.response.use(
6363

6464
const originalRequest = error.config;
6565

66-
if (!originalRequest) return Promise.reject(error);
67-
68-
if (originalRequest.url === '/auth/reissue') {
69-
logout();
66+
if (!originalRequest || originalRequest.url === '/auth/reissue') {
67+
if (isLoggedIn) logout();
7068
return Promise.reject(error);
7169
}
7270

@@ -77,6 +75,9 @@ client.interceptors.response.use(
7775
originalRequest._retry = true;
7876

7977
if (isRefreshing) {
78+
console.log('request', originalRequest);
79+
console.log('isRefreshing');
80+
console.log('failedQueue', failedQueue);
8081
try {
8182
return new Promise((resolve, reject) => {
8283
failedQueue.push({
@@ -107,7 +108,8 @@ client.interceptors.response.use(
107108
}
108109
}
109110
}
110-
logout();
111+
if (isLoggedIn) logout();
112+
console.error('Failed to refresh token', error);
111113
return Promise.reject(error);
112114
},
113115
);

0 commit comments

Comments
 (0)