summaryrefslogtreecommitdiff
path: root/lib/bidding/vendor/components/simple-file-upload.tsx
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-09-09 10:34:05 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-09-09 10:34:05 +0000
commit86b1fd1cc801f45642f84d24c0b5c84368454ff0 (patch)
tree63176d1feb6d3fbbb71d942343056ba6d793b586 /lib/bidding/vendor/components/simple-file-upload.tsx
parentc62ec046327fd388ebce04571b55910747e69a3b (diff)
(최겸) 구매 입찰 사전견적, 입찰, 낙찰, 유찰, 재입찰 기능 개발
Diffstat (limited to 'lib/bidding/vendor/components/simple-file-upload.tsx')
-rw-r--r--lib/bidding/vendor/components/simple-file-upload.tsx20
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/bidding/vendor/components/simple-file-upload.tsx b/lib/bidding/vendor/components/simple-file-upload.tsx
index b1eb8b8f..58b60bdf 100644
--- a/lib/bidding/vendor/components/simple-file-upload.tsx
+++ b/lib/bidding/vendor/components/simple-file-upload.tsx
@@ -65,15 +65,23 @@ export function SimpleFileUpload({
try {
setIsLoading(true)
const docs = await getPreQuoteDocuments(biddingId, companyId)
+
+ // docs가 undefined이거나 배열이 아닌 경우 빈 배열로 처리
+ if (!docs || !Array.isArray(docs)) {
+ setDocuments([])
+ return
+ }
+
// Date를 string으로 변환
const mappedDocs = docs.map(doc => ({
...doc,
- uploadedAt: doc.uploadedAt.toString(),
+ uploadedAt: doc.uploadedAt?.toString() || '',
uploadedBy: doc.uploadedBy || ''
}))
setDocuments(mappedDocs)
} catch (error) {
console.error('Failed to load documents:', error)
+ setDocuments([]) // 에러 시에도 빈 배열로 설정
toast({
title: '오류',
description: '업로드된 문서 목록을 불러오는데 실패했습니다.',
@@ -155,9 +163,13 @@ export function SimpleFileUpload({
if (result.success) {
try {
- await downloadFile(result.document?.filePath, result.document?.originalFileName, {
- showToast: true
- })
+ if (result.document?.filePath && result.document?.originalFileName) {
+ await downloadFile(result.document.filePath, result.document.originalFileName, {
+ showToast: true
+ })
+ } else {
+ throw new Error('파일 정보가 없습니다.')
+ }
} catch (error) {
toast({
title: '다운로드 실패',