File tree Expand file tree Collapse file tree 4 files changed +9
-10
lines changed Expand file tree Collapse file tree 4 files changed +9
-10
lines changed Original file line number Diff line number Diff line change 11import axios from 'axios' ;
22import { useAuthStore } from '@/store/authStore' ;
33import { reissueToken } from '@/apis/auth' ;
4- import { QueryClient } from '@tanstack/react-query' ;
5-
6- const queryClient = new QueryClient ( ) ;
4+ import { queryClient } from '@/utils' ;
75
86const API_BASE_URL =
97 import . meta. env . MODE === 'development'
@@ -71,8 +69,7 @@ axiosInstance.interceptors.response.use(
7169 } catch ( error ) {
7270 useAuthStore . getState ( ) . logout ( ) ;
7371 useAuthStore . persist . clearStorage ( ) ;
74- queryClient . removeQueries ( { queryKey : [ 'myProfile' ] } ) ; // 프로필 정보 캐시 초기화
75- queryClient . removeQueries ( { queryKey : [ 'userPosts' , 'me' ] } ) ; // 포스트 정보 캐시 초기화
72+ queryClient . clear ( ) ; // 모든 쿼리, 변이 상태, 캐시 전부 제거
7673 console . error ( 'AT 토큰 재발급 실패:' , error ) ;
7774
7875 return Promise . reject ( error ) ;
Original file line number Diff line number Diff line change 11import { createRoot } from 'react-dom/client' ;
22import { BrowserRouter } from 'react-router' ;
3- import { QueryClient , QueryClientProvider } from '@tanstack/react-query' ;
3+ import { QueryClientProvider } from '@tanstack/react-query' ;
44import { registerSW } from 'virtual:pwa-register' ;
55import { ReactQueryDevtools } from '@tanstack/react-query-devtools' ;
66import './styles/index.css' ;
77import App from './App.tsx' ;
88import ScrollToTop from '@/components/ScrollToTop.tsx' ;
9+ import { queryClient } from '@/utils' ;
910
1011// PWA 서비스 워커 등록
1112const updateSW = registerSW ( {
@@ -19,9 +20,6 @@ const updateSW = registerSW({
1920 } ,
2021} ) ;
2122
22- // 🔹 QueryClient 생성
23- const queryClient = new QueryClient ( ) ;
24-
2523createRoot ( document . getElementById ( 'root' ) ! ) . render (
2624 < QueryClientProvider client = { queryClient } >
2725 < BrowserRouter >
Original file line number Diff line number Diff line change 1+ import { queryClient } from './queryClient' ;
12import { cn } from './cn' ;
23
3- export { cn } ;
4+ export { cn , queryClient } ;
Original file line number Diff line number Diff line change 1+ import { QueryClient } from '@tanstack/react-query' ;
2+
3+ export const queryClient = new QueryClient ( ) ;
You can’t perform that action at this time.
0 commit comments