Skip to content

Commit

Permalink
Hotfix : 이미지 업로드 이슈 해결 (#598)
Browse files Browse the repository at this point in the history
  • Loading branch information
guesung authored Jan 26, 2024
1 parent a4e9ff2 commit 68567b2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
6 changes: 1 addition & 5 deletions src/apis/common/apis.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import publicApi from '../config/publicApi';
import { compressImage } from '@/utils/compressImage';

import type { FilesRequest, FilesResponse } from '.';

export const postFiles = async ({ fileList }: FilesRequest) => {
const formData = new FormData();

const compressedFileList = await Promise.all(fileList.map((file) => compressImage(file)));

compressedFileList.forEach((file) => {
fileList.forEach((file) => {
formData.append('fileList', file);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default function CreateGroupContextProvider({ children }: StrictPropsWith
const methods = useForm<CreateGroupContextValue>({
defaultValues: {
imageUrl: '',
previewImage: '',
title: '',
content: '',
meetDate: new Date(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function UploadSection({ control }: ImageThumbnailProps) {
control,
});

const { handleFileUploadClick, previewImage } = useFileUpload(async (files) => {
const { handleFileUploadClick } = useFileUpload(async (files) => {
field.onChange(files[0]);
});

Expand All @@ -29,7 +29,7 @@ export default function UploadSection({ control }: ImageThumbnailProps) {
className="relative mx-20 aspect-[8/5] overflow-hidden rounded-8 bg-sub"
onClick={handleFileUploadClick}
>
<RenderImage previewImage={previewImage} />
<RenderImage previewImage={field.value} />
</Flex>
);
}
Expand Down

0 comments on commit 68567b2

Please sign in to comment.