Skip to content

Commit 83b5de9

Browse files
committedDec 8, 2023
fix
1 parent 2e5a6a1 commit 83b5de9

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed
 

‎src/components/Declaration/DeclarationComponent.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,21 @@ const DeclarationComponent = () => {
5353
return blob;
5454
};
5555

56+
function generateUniqueFileName(extension) {
57+
const timestamp = new Date().getTime(); // 현재 시간을 밀리초로 얻기
58+
const randomString = Math.random().toString(36).substring(2, 8); // 무작위 문자열 생성
59+
60+
return `${timestamp}_${randomString}.${extension}`;
61+
}
62+
5663
const onClickReport = async (e) => {
5764
e.preventDefault();
5865
setPopup(current => !current);
5966

6067
const croppedBlob = dataURItoBlob(preview); // 데이터 URI를 Blob으로 변환
61-
const croppedFile = new File([croppedBlob], 'cropped_image.png', { type: 'image/png' }); // Blob을 File 객체로 변환
68+
const uniqueFileName = generateUniqueFileName('png'); // 확장자에 맞게 수정 가능
69+
70+
const croppedFile = new File([croppedBlob], uniqueFileName, { type: 'image/png' }); // Blob을 File 객체로 변환
6271

6372
const newFormData = {
6473
...formData,

‎src/components/Map/MapComponent.js

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const MapComponent = () => {
2121
});
2222
console.log('GET 요청 성공:', response.data.reportListDtoList);
2323
setMarkerData(response.data.reportListDtoList);
24+
console.log(response.data)
2425
} catch (error) {
2526
console.error('GET 요청 실패:', error.response.data.message);
2627
}

0 commit comments

Comments
 (0)