Skip to content

Commit c7d7510

Browse files
committed
feat: 엑세스 토큰 없을 시 로그아웃 추가
1 parent b101327 commit c7d7510

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/lib/reactQueryProvider.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { PropsWithChildren, useState } from "react";
44
import axios from "axios";
55
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
66
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
7+
import { useRouter } from "next/navigation";
78

89
import {
910
getLoginInfo,
@@ -92,6 +93,10 @@ apiClient.interceptors.response.use(
9293
} catch (refreshError) {
9394
processQueue(refreshError, null);
9495
removeLocalStorageAll();
96+
if (typeof window !== "undefined") {
97+
const router = useRouter();
98+
router.push("/login");
99+
}
95100
throw refreshError;
96101
} finally {
97102
isRefreshing = false;

0 commit comments

Comments
 (0)