We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c6352ef + 0a3cdf2 commit 2f63d48Copy full SHA for 2f63d48
src/apis/auth.ts
@@ -35,6 +35,8 @@ export const reissueToken = async () => {
35
if (code === 200) {
36
useAuthStore.getState().setAccessToken(accessToken); // 토큰 전역 상태 저장
37
console.log('토큰 재발급 성공:', accessToken);
38
+ } else {
39
+ throw new Error('토큰 재발급 실패');
40
}
41
return data;
42
};
src/apis/axios.ts
@@ -40,6 +40,7 @@ axiosInstance.interceptors.response.use(
await reissueToken(); // 토큰 재발급 요청
return axiosInstance(originalRequest); // 원래 요청 다시 시도
} catch (error) {
43
+ useAuthStore.getState().logout();
44
useAuthStore.persist.clearStorage();
45
console.error('AT 토큰 재발급 실패:', error);
46
0 commit comments