From 2650b7c0bb0ea12b68a58c0439f72d61df04b2f1 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Fri, 25 Jul 2025 07:51:15 +0000
Subject: (대표님) 정기평가 대상, 미들웨어 수정, nextauth 토큰 처리 개선, GTC
 등 (최겸) 기술영업
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../table/evaluation-target-table.tsx              | 36 +++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

(limited to 'lib/evaluation-target-list/table/evaluation-target-table.tsx')

diff --git a/lib/evaluation-target-list/table/evaluation-target-table.tsx b/lib/evaluation-target-list/table/evaluation-target-table.tsx
index c65a7815..9cc73003 100644
--- a/lib/evaluation-target-list/table/evaluation-target-table.tsx
+++ b/lib/evaluation-target-list/table/evaluation-target-table.tsx
@@ -323,6 +323,39 @@ export function EvaluationTargetsTable({ promises, evaluationYear, className }:
     return () => clearTimeout(timeoutId);
   }, [searchString, evaluationYear, getSearchParam]);
 
+  const refreshData = React.useCallback(async () => {
+    try {
+      setIsDataLoading(true);
+      
+      // 현재 URL 파라미터로 데이터 새로고침
+      const currentFilters = getSearchParam("filters");
+      const currentJoinOperator = getSearchParam("joinOperator", "and");
+      const currentPage = parseInt(getSearchParam("page", "1"));
+      const currentPerPage = parseInt(getSearchParam("perPage", "10"));
+      const currentSort = getSearchParam('sort') ? JSON.parse(getSearchParam('sort')!) : [{ id: "createdAt", desc: true }];
+      const currentSearch = getSearchParam("search", "");
+      
+      const searchParams = {
+        filters: currentFilters ? JSON.parse(currentFilters) : [],
+        joinOperator: currentJoinOperator as "and" | "or",
+        page: currentPage,
+        perPage: currentPerPage,
+        sort: currentSort,
+        search: currentSearch,
+        evaluationYear: evaluationYear
+      };
+      
+      const newData = await getEvaluationTargets(searchParams);
+      setTableData(newData);
+      
+      console.log("=== 데이터 새로고침 완료 ===", newData.data.length, "건");
+    } catch (error) {
+      console.error("데이터 새로고침 오류:", error);
+    } finally {
+      setIsDataLoading(false);
+    }
+  }, [evaluationYear, getSearchParam]);
+
   /* --------------------------- layout refs --------------------------- */
   const containerRef = React.useRef<HTMLDivElement>(null);
   const [containerTop, setContainerTop] = React.useState(0);
@@ -597,7 +630,7 @@ export function EvaluationTargetsTable({ promises, evaluationYear, className }:
                       onRenamePreset={renamePreset}
                     />
 
-                    <EvaluationTargetsTableToolbarActions table={table} />
+                    <EvaluationTargetsTableToolbarActions table={table}onRefresh={refreshData} />
                   </div>
                 </DataTableAdvancedToolbar>
               </DataTable>
@@ -607,6 +640,7 @@ export function EvaluationTargetsTable({ promises, evaluationYear, className }:
                 open={rowAction?.type === "update"}
                 onOpenChange={() => setRowAction(null)}
                 evaluationTarget={rowAction?.row.original ?? null}
+                onDataChange={refreshData}
               />
             </div>
           </div>
-- 
cgit v1.2.3

