p_atflCd. 추가로직 정리
This commit is contained in:
@@ -17,3 +17,4 @@ dist
|
|||||||
|
|
||||||
# env
|
# env
|
||||||
.env*
|
.env*
|
||||||
|
.qodo
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
NEXT_PUBLIC_PORT=3000
|
NEXT_PUBLIC_PORT=3000
|
||||||
NEXT_PUBLIC_SERVER_API_URL=http://192.168.0.102:8000
|
NEXT_PUBLIC_SERVER_API_URL=http://localhost:8000
|
||||||
|
|||||||
@@ -11,8 +11,12 @@ function ImagePage() {
|
|||||||
const file = e.target.files?.item(0);
|
const file = e.target.files?.item(0);
|
||||||
if (!file) return;
|
if (!file) return;
|
||||||
|
|
||||||
|
//const p_atflCd = store.getState().upload.atflCd; // Redux 스토어에서 atflCd 가져오기
|
||||||
|
|
||||||
|
|
||||||
const upload = new Upload(file, {
|
const upload = new Upload(file, {
|
||||||
endpoint: `${ENDPOINT.ATTACH_SERVICE.TUS_UPLOAD}`,
|
endpoint: `${ENDPOINT.ATTACH_SERVICE.TUS_UPLOAD}`,
|
||||||
|
chunkSize: 10 * 1024 * 1024, // 5MB chunk size
|
||||||
headers: {
|
headers: {
|
||||||
[CLAIM_NAME]: getCookie(CLAIM_NAME) ?? "",
|
[CLAIM_NAME]: getCookie(CLAIM_NAME) ?? "",
|
||||||
[AUTH_USER_ID]: getCookie(AUTH_USER_ID) ?? "",
|
[AUTH_USER_ID]: getCookie(AUTH_USER_ID) ?? "",
|
||||||
@@ -20,7 +24,8 @@ function ImagePage() {
|
|||||||
retryDelays: [0, 3000, 5000, 10000, 20000],
|
retryDelays: [0, 3000, 5000, 10000, 20000],
|
||||||
metadata: {
|
metadata: {
|
||||||
filename: file.name,
|
filename: file.name,
|
||||||
filetype: file.type,
|
filetype: file.type
|
||||||
|
// atflCd: p_atflCd,
|
||||||
},
|
},
|
||||||
onError: function (error) {
|
onError: function (error) {
|
||||||
console.log("Failed because: " + error);
|
console.log("Failed because: " + error);
|
||||||
@@ -35,6 +40,20 @@ function ImagePage() {
|
|||||||
(upload.file as File).name,
|
(upload.file as File).name,
|
||||||
upload.url,
|
upload.url,
|
||||||
);
|
);
|
||||||
|
console.log("upload._req:", upload._req);
|
||||||
|
|
||||||
|
if(upload._req){
|
||||||
|
const xhr = upload._req._xhr; // 업로드에 사용된 XMLHttpRequest 객체
|
||||||
|
const xFileInfo = xhr.getResponseHeader('X-file-info'); // X-file-info 헤더 가져오기
|
||||||
|
if (xFileInfo) {
|
||||||
|
const fileInfo = JSON.parse(xFileInfo);
|
||||||
|
console.log('fileInfo :', fileInfo);
|
||||||
|
const downloadUrl = `${ENDPOINT.ATTACH_SERVICE.TUS_DOWNLOAD}/${fileInfo.atflId}`;
|
||||||
|
console.log('Download URL:', downloadUrl);
|
||||||
|
// store.dispatch(setAtflCd(fileInfo.atflCd)); // atflCd 저장
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user