Skip to content

Commit 87d4340

Browse files
committed
자동로그아웃 처리
1 parent 42a4faf commit 87d4340

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/api/globalFetch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ window.fetch = async (...args) => {
88
// 3. 백업해둔 원래 fetch 함수를 호출하여 실제 API 요청을 보냅니다.
99
const response = await originalFetch(...args);
1010

11-
// 4. 응답을 받은 후, 만약 401 에러(토큰 만료)가 발생했다면
12-
if (response.status === 401) {
11+
// 4. 응답을 받은 후, 인증 실패(401/403)가 발생했다면
12+
if (response.status === 401 || response.status === 403) {
1313
// 이전에 localStorage에 저장된 토큰이 있을 때만 로그아웃 처리
1414
if (localStorage.getItem('token')) {
1515
localStorage.removeItem('token');

0 commit comments

Comments
 (0)