From e9897d416b3e7327bbd4d4aef887eee37751ae82 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Fri, 27 Jun 2025 01:16:20 +0000
Subject: (대표님) 20250627 오전 10시 작업사항
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 components/layout/providers.tsx | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

(limited to 'components/layout/providers.tsx')

diff --git a/components/layout/providers.tsx b/components/layout/providers.tsx
index 376c419a..78f96d61 100644
--- a/components/layout/providers.tsx
+++ b/components/layout/providers.tsx
@@ -6,9 +6,9 @@ import { ThemeProvider as NextThemesProvider } from "next-themes"
 import { NuqsAdapter } from "nuqs/adapters/next/app"
 import { SessionProvider } from "next-auth/react"
 import { CacheProvider } from '@emotion/react'
-import { SWRConfig } from 'swr' // ✅ SWR 추가
-
+import { SWRConfig } from 'swr'
 import { TooltipProvider } from "@/components/ui/tooltip"
+import { SessionManager } from "@/components/layout/SessionManager" // ✅ SessionManager 추가
 import createEmotionCache from './createEmotionCashe'
 
 const cache = createEmotionCache()
@@ -21,18 +21,18 @@ const swrConfig = {
   shouldRetryOnError: false,       // 에러시 자동 재시도 비활성화 (수동으로 제어)
   dedupingInterval: 2000,          // 2초 내 중복 요청 방지
   refreshInterval: 0,              // 기본적으로 자동 갱신 비활성화 (개별 훅에서 설정)
-  
+
   // 간단한 전역 에러 핸들러 (토스트 없이 로깅만)
   onError: (error: any, key: string) => {
     // 개발 환경에서만 상세 로깅
     if (process.env.NODE_ENV === 'development') {
-      console.warn('SWR fetch failed:', { 
-        url: key, 
-        status: error?.status, 
-        message: error?.message 
+      console.warn('SWR fetch failed:', {
+        url: key,
+        status: error?.status,
+        message: error?.message
       })
     }
-    
+
     // 401 Unauthorized의 경우 특별 처리 (선택사항)
     if (error?.status === 401) {
       console.warn('Authentication required')
@@ -40,16 +40,21 @@ const swrConfig = {
       // window.location.href = '/login'
     }
   },
-  
+
   // 전역 성공 핸들러는 제거 (너무 많은 로그 방지)
-  
+
   // 기본 fetcher 제거 (각 훅에서 개별 관리)
 }
 
+interface ThemeProviderProps extends React.ComponentProps<typeof NextThemesProvider> {
+  lng?: string; // ✅ lng prop 추가
+}
+
 export function ThemeProvider({
   children,
+  lng = 'ko', // ✅ 기본값 설정
   ...props
-}: React.ComponentProps<typeof NextThemesProvider>) {
+}: ThemeProviderProps) {
   return (
     <JotaiProvider>
       <CacheProvider value={cache}>
@@ -60,6 +65,8 @@ export function ThemeProvider({
                 {/* ✅ 간소화된 SWR 설정 적용 */}
                 <SWRConfig value={swrConfig}>
                   {children}
+                  {/* ✅ SessionManager 추가 - 모든 프로바이더 내부에 위치 */}
+                  <SessionManager lng={lng} />
                 </SWRConfig>
               </SessionProvider>
             </NuqsAdapter>
@@ -68,4 +75,4 @@ export function ThemeProvider({
       </CacheProvider>
     </JotaiProvider>
   )
-}
+}
\ No newline at end of file
-- 
cgit v1.2.3

