diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-05-13 10:07:56 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-05-13 10:07:56 +0000 |
| commit | de9cb0808c4f369de8248a408dd48c9c4725b79d (patch) | |
| tree | a6279c11f593dcc8d0f855fafaf49c8658a1faa8 /lib/items | |
| parent | 55264117d760fa7278094ee6b137c187f1ac660b (diff) | |
(김준회) Fasoo DRM 해제 서버액션 개발, 아이템 및 PQ정보 임포트에 적용
Diffstat (limited to 'lib/items')
| -rw-r--r-- | lib/items/table/import-excel-button.tsx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/items/table/import-excel-button.tsx b/lib/items/table/import-excel-button.tsx index 484fd778..845f5fe2 100644 --- a/lib/items/table/import-excel-button.tsx +++ b/lib/items/table/import-excel-button.tsx @@ -16,6 +16,7 @@ import { } from "@/components/ui/dialog" import { Progress } from "@/components/ui/progress" import { processFileImport } from "./import-item-handler" // 별도 파일로 분리 +import { decryptWithServerAction } from "@/components/drm/drmUtils" interface ImportItemButtonProps { onSuccess?: () => void @@ -55,8 +56,19 @@ export function ImportItemButton({ onSuccess }: ImportItemButtonProps) { setProgress(0) setError(null) - // 파일을 ArrayBuffer로 읽기 - const arrayBuffer = await file.arrayBuffer(); + // DRM 복호화 처리 - 서버 액션 직접 호출 + let arrayBuffer: ArrayBuffer; + try { + setProgress(10); + toast.info("파일 복호화 중..."); + arrayBuffer = await decryptWithServerAction(file); + setProgress(30); + } catch (decryptError) { + console.error("파일 복호화 실패, 원본 파일 사용:", decryptError); + toast.warning("파일 복호화에 실패하여 원본 파일을 사용합니다."); + // 복호화 실패 시 원본 파일 사용 + arrayBuffer = await file.arrayBuffer(); + } // ExcelJS 워크북 로드 const workbook = new ExcelJS.Workbook(); |
