Skip to content

Commit

Permalink
chore: 디바운싱 임시 주석 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
seojisoosoo committed Dec 21, 2024
1 parent ad956a2 commit dd6b1a2
Showing 1 changed file with 23 additions and 24 deletions.
47 changes: 23 additions & 24 deletions src/hooks/useImageUploader.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import debounce from 'lodash-es/debounce';
import { useRef } from 'react';

import { getPresignedUrl, putPresignedUrl } from '@/api/endpoint/common/image';
Expand Down Expand Up @@ -26,33 +25,33 @@ export default function useImageUploader({ onSuccess, resizeHeight }: Options) {
// : await Promise.all(Array.from(inputEl.files).map((file) => tryResizeFile(file, resizeHeight)));
const files = inputEl.files;

const uploadFiles = debounce(async () => {
const urls: string[] = [];
// const uploadFiles = debounce(async () => {
const urls: string[] = [];

await Promise.all(
Array.from(files).map(async (file) => {
try {
const { filename, signedUrl } = await getPresignedUrl.request({ filename: file.name });
if (!signedUrl) {
throw new Error('presigned-url을 받아오는데 실패하였습니다.');
}
await Promise.all(
Array.from(files).map(async (file) => {
try {
const { filename, signedUrl } = await getPresignedUrl.request({ filename: file.name });
if (!signedUrl) {
throw new Error('presigned-url을 받아오는데 실패하였습니다.');
}

await putPresignedUrl({
signedUrl: decodeURIComponent(signedUrl),
file,
});
await putPresignedUrl({
signedUrl: decodeURIComponent(signedUrl),
file,
});

const s3Url = `https://s3.ap-northeast-2.amazonaws.com/sopt-makers-internal/${filename}`;
urls.push(s3Url);
} catch (error) {
console.error(error);
}
}),
);
onSuccess?.(urls);
}, 500);
const s3Url = `https://s3.ap-northeast-2.amazonaws.com/sopt-makers-internal/${filename}`;
urls.push(s3Url);
} catch (error) {
console.error(error);
}
}),
);
onSuccess?.(urls);
// }, 500);

uploadFiles();
// uploadFiles();
};

inputEl.click();
Expand Down

0 comments on commit dd6b1a2

Please sign in to comment.