From d6d3bbc55a557acde7d1f07c3bd4813e367d4e86 Mon Sep 17 00:00:00 2001
From: 0-Zz-ang <s1998319@gmail.com>
Date: Thu, 25 Sep 2025 15:57:18 +0900
Subject: (박서영)동의관련 언어설정 추가
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 components/polices/policy-management-client.tsx | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

(limited to 'components/polices/policy-management-client.tsx')

diff --git a/components/polices/policy-management-client.tsx b/components/polices/policy-management-client.tsx
index eecb82ff..24a0a97c 100644
--- a/components/polices/policy-management-client.tsx
+++ b/components/polices/policy-management-client.tsx
@@ -35,9 +35,10 @@ interface PolicyManagementClientProps {
     allPolicies: Record<string, any[]>
     stats: any
   }
+  currentLocale?: 'ko' | 'en'
 }
 
-export function PolicyManagementClient({ initialData }: PolicyManagementClientProps) {
+export function PolicyManagementClient({ initialData, currentLocale = 'ko' }: PolicyManagementClientProps) {
   const [currentTab, setCurrentTab] = useState('privacy_policy')
   const [editingPolicy, setEditingPolicy] = useState<string | null>(null)
   const [viewingHistory, setViewingHistory] = useState<string | null>(null)
@@ -57,6 +58,7 @@ export function PolicyManagementClient({ initialData }: PolicyManagementClientPr
   const { toast } = useToast();
   const router = useRouter()
 
+
   const policyTypes = [
     {
       key: 'privacy_policy',
@@ -91,11 +93,13 @@ export function PolicyManagementClient({ initialData }: PolicyManagementClientPr
     
     startTransition(async () => {
       try {
-        const history = await getPolicyHistory(policyType)
-        setPolicies(prev => ({
-          ...prev,
-          [policyType]: history || [] // ✅ null/undefined 방지
-        }))
+        const result = await getPolicyHistory(policyType, currentLocale)
+        if (result.success) {
+          setPolicies(prev => ({
+            ...prev,
+            [policyType]: result.data || []
+          }))
+        } 
       } catch (error) {
         console.error('Policy history error:', error)
         toast({
@@ -134,6 +138,7 @@ export function PolicyManagementClient({ initialData }: PolicyManagementClientPr
 
         const result = await createPolicyVersion({
           policyType: policyType as 'privacy_policy' | 'terms_of_service',
+          locale: currentLocale,
           version,
           content,
           effectiveDate: new Date()
@@ -249,6 +254,7 @@ export function PolicyManagementClient({ initialData }: PolicyManagementClientPr
           onCancel={() => setEditingPolicy(null)}
           onPreview={handlePreview}
           isLoading={isPending}
+          currentLocale={currentLocale}
         />
       )
     }
-- 
cgit v1.2.3

