@daeryun/dr_components 1.1.21 → 1.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/components/BrochureBtn/BrochureBtn.jsx +4 -0
- package/dist/components/BrochureBtn/BrochureBtn.stories.jsx +1 -1
- package/dist/components/BrochureBtn/BrochureBtn.stories.tsx +1 -1
- package/dist/components/BrochureBtn/BrochureBtn.tsx +4 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useHistoryHandler.js +1 -1
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useHistoryHandler.ts +1 -1
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +24 -16
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +73 -70
- package/dist/components/common/integrate/index.d.ts +1 -1
- package/dist/components/page/MapPage/MapPage.jsx +1 -1
- package/dist/components/page/MapPage/MapPage.tsx +1 -1
- package/dist/components/page/MyCase/[id]/_component/_document/Document.jsx +2 -2
- package/dist/components/page/MyCase/[id]/_component/_document/Document.tsx +2 -2
- package/dist/components/page/MyCase/[id]/_component/_document/FileUpload.js +3 -3
- package/dist/components/page/MyCase/[id]/_component/_document/FileUpload.ts +3 -4
- package/dist/components/page/MyCase/_actions/action.d.ts +12 -7
- package/dist/components/page/MyCase/_actions/action.js +5 -10
- package/dist/components/page/MyCase/_actions/action.ts +13 -16
- package/dist/components/page/MyCase/_fetchers/addMyFileUpload.d.ts +7 -2
- package/dist/components/page/MyCase/_fetchers/addMyFileUpload.js +36 -27
- package/dist/components/page/MyCase/_fetchers/addMyFileUpload.ts +41 -29
- package/dist/styles/globals.css +386 -386
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Fetch from '../../Login/_fetch/fetch';
|
|
2
2
|
|
|
3
|
-
const addMyFileUpload = async ({ id, file }: { id: string; file: File }) => {
|
|
3
|
+
const addMyFileUpload = async ({ id, file }: { id: string; file: File[] }) => {
|
|
4
4
|
try {
|
|
5
5
|
// 1단계: S3 presigned URL 요청
|
|
6
6
|
const response = await Fetch(`/api/lawfirm/app/s3-upload`, {
|
|
@@ -12,7 +12,7 @@ const addMyFileUpload = async ({ id, file }: { id: string; file: File }) => {
|
|
|
12
12
|
target: 'legalCase',
|
|
13
13
|
caseIdx: parseInt(id, 10),
|
|
14
14
|
parentDir: null,
|
|
15
|
-
fileNames:
|
|
15
|
+
fileNames: file.map(file => file.name)
|
|
16
16
|
})
|
|
17
17
|
});
|
|
18
18
|
|
|
@@ -21,49 +21,61 @@ const addMyFileUpload = async ({ id, file }: { id: string; file: File }) => {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
// 2단계: 받은 presigned URL로 실제 파일을 S3에 업로드
|
|
24
|
-
const uploadData
|
|
25
|
-
|
|
24
|
+
const uploadData: { url: string; name: string }[] = response.data;
|
|
25
|
+
// 2단계: presigned URL 로 각각의 파일 업로드
|
|
26
|
+
const uploadResults = await Promise.all(
|
|
27
|
+
uploadData.map(async ({ url: presignedUrl, name }) => {
|
|
28
|
+
const targetFile = file.find(f => f.name === name);
|
|
29
|
+
if (!targetFile) throw new Error(`File not found for ${name}`);
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
body: file
|
|
34
|
-
});
|
|
31
|
+
const uploadResponse = await fetch(presignedUrl, {
|
|
32
|
+
method: 'PUT',
|
|
33
|
+
headers: { 'Content-Type': 'application/octet-stream' },
|
|
34
|
+
body: targetFile
|
|
35
|
+
});
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
if (!uploadResponse.ok) {
|
|
38
|
+
throw new Error(`S3 upload failed: ${uploadResponse.statusText}`);
|
|
39
|
+
}
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const cloudFrontPath = `https://d6robzfync7d.cloudfront.net${s3Path}`;
|
|
41
|
+
// CloudFront 경로 변환
|
|
42
|
+
const urlObject = new URL(presignedUrl);
|
|
43
|
+
const s3Path = urlObject.pathname;
|
|
44
|
+
const cloudFrontPath = `https://d6robzfync7d.cloudfront.net${s3Path}`;
|
|
45
45
|
|
|
46
|
+
return {
|
|
47
|
+
name,
|
|
48
|
+
path: cloudFrontPath,
|
|
49
|
+
size: targetFile.size,
|
|
50
|
+
status: uploadResponse.status
|
|
51
|
+
};
|
|
52
|
+
})
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
// if (!uploadResponse.ok) {
|
|
56
|
+
// throw new Error(`S3 upload failed: ${uploadResponse.statusText}`)
|
|
57
|
+
// }
|
|
58
|
+
|
|
59
|
+
// 3단계: 서버에 업로드 완료 알림
|
|
46
60
|
const notifyResponse = await Fetch(`/api/lawfirm/app/case/${id}/docs/upload`, {
|
|
47
61
|
method: 'POST',
|
|
48
62
|
headers: {
|
|
49
|
-
// Authorization: `${jwt}
|
|
63
|
+
// Authorization: `${jwt}`,
|
|
50
64
|
},
|
|
51
65
|
body: JSON.stringify({
|
|
52
66
|
caseIdx: parseInt(id, 10),
|
|
53
|
-
files:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
]
|
|
67
|
+
files: uploadResults.map(({ name, path, size }) => ({
|
|
68
|
+
name,
|
|
69
|
+
path,
|
|
70
|
+
size
|
|
71
|
+
}))
|
|
60
72
|
})
|
|
61
73
|
});
|
|
62
74
|
|
|
63
75
|
return {
|
|
64
76
|
result: true,
|
|
65
77
|
data: response.data,
|
|
66
|
-
|
|
78
|
+
uploads: uploadResults,
|
|
67
79
|
notificationStatus: notifyResponse.result
|
|
68
80
|
};
|
|
69
81
|
} catch (error) {
|