From 9e3458481a65bb5572b7f1916e7c068b54a434c5 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Tue, 30 Sep 2025 06:41:26 +0000
Subject: (최겸) 구매 협력업체 정기평가, 가입승인, 기본계약 리비전 등
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/evaluation-submit/evaluation-page.tsx | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

(limited to 'lib/evaluation-submit/evaluation-page.tsx')

diff --git a/lib/evaluation-submit/evaluation-page.tsx b/lib/evaluation-submit/evaluation-page.tsx
index 810ed03e..4497b9ef 100644
--- a/lib/evaluation-submit/evaluation-page.tsx
+++ b/lib/evaluation-submit/evaluation-page.tsx
@@ -8,7 +8,9 @@ import { Skeleton } from "@/components/ui/skeleton"
 import { AlertCircle, ArrowLeft, RefreshCw } from "lucide-react"
 import { Alert, AlertDescription } from "@/components/ui/alert"
 
-import { getEvaluationFormData, EvaluationFormData } from "./service"
+import { getEvaluationFormData } from "./service"
+import { EvaluationFormData } from "@/types/evaluation-form"
+
 import { EvaluationForm } from "./evaluation-form"
 
 /**
@@ -174,7 +176,7 @@ export function EvaluationPage() {
   const [isLoading, setIsLoading] = React.useState(true)
   const [error, setError] = React.useState<string | null>(null)
 
-  const reviewerEvaluationId = params.id ? parseInt(params.id as string) : null
+  const reviewerEvaluationId = params?.id ? parseInt(params.id as string) : null
 
   // 평가 데이터 로드
   const loadEvaluationData = React.useCallback(async () => {
@@ -187,24 +189,25 @@ export function EvaluationPage() {
     try {
       setIsLoading(true)
       setError(null)
-      
+      console.log(`[CLIENT] Loading evaluation data for ID: ${reviewerEvaluationId}`)
       const data = await getEvaluationFormData(reviewerEvaluationId)
       
       if (!data) {
-        setError("평가 데이터를 찾을 수 없습니다.")
+        console.warn(`[CLIENT] No evaluation data returned for ID: ${reviewerEvaluationId}`)
+        setError("평가 데이터를 찾을 수 없습니다. 해당 평가가 존재하지 않거나 접근 권한이 없을 수 있습니다.")
         return
       }
+
+      console.log(`[CLIENT] Successfully loaded evaluation data for ID: ${reviewerEvaluationId}`)
       
-      setFormData(data)
-    } catch (err) {
-      console.error('Failed to load evaluation data:', err)
-      setError(
-        err instanceof Error 
-          ? err.message 
-          : "평가 데이터를 불러오는 중 오류가 발생했습니다."
-      )
-    } finally {
-      setIsLoading(false)
+    setFormData(data as EvaluationFormData)
+  } catch (err) {
+    console.error('[CLIENT] Failed to load evaluation data:', err)
+    const errorMessage = err instanceof Error ? err.message : "알 수 없는 오류"
+    setError(`평가 데이터를 불러오는 중 오류가 발생했습니다: ${errorMessage}`)
+  } finally {
+    setIsLoading(false)
+    console.log('[CLIENT] Loading completed')
     }
   }, [reviewerEvaluationId])
 
-- 
cgit v1.2.3

