Skip to content

Commit 530e4f2

Browse files
committed
Feat: 세션 만료 시, 로그인 화면으로 보내줄 응답 인터셉터 추가
1 parent ccf3af7 commit 530e4f2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/api/axiosInstanceApi.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,15 @@ export const proxy = axios.create({
1313
withCredentials: true,
1414
});
1515

16+
proxy.interceptors.response.use(
17+
(response) => response,
18+
(error) => {
19+
if (error.response?.status === 401) {
20+
alert("세션이 만료되었습니다. 다시 로그인해주세요.");
21+
window.location.href = "/login";
22+
}
23+
return Promise.reject(error);
24+
}
25+
);
26+
1627
export default axiosInstance;

0 commit comments

Comments
 (0)