Skip to content

Commit df1713e

Browse files
committed
fix: 이미지 파일 없을 때 presignedURL을 요청하지 않게 수정
1 parent 59278c7 commit df1713e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

app/queries/getPreSignedUrl.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,16 @@ const useHintUpload = () => {
145145
answerFiles: File[]
146146
) => {
147147
try {
148-
const presignedResponse = await presignedMutation.mutateAsync({
149-
themeId: formData.themeId,
150-
hintImageCount: hintFiles.length,
151-
answerImageCount: answerFiles.length,
152-
});
148+
const presignedResponse =
149+
hintFiles.length > 0 || answerFiles.length > 0
150+
? await presignedMutation.mutateAsync({
151+
themeId: formData.themeId,
152+
hintImageCount: hintFiles.length,
153+
answerImageCount: answerFiles.length,
154+
})
155+
: { data: { hintImageUrlList: [], answerImageUrlList: [] } };
153156

154-
const { hintImageUrlList = [], answerImageUrlList = [] } =
155-
presignedResponse.data;
157+
const { hintImageUrlList, answerImageUrlList } = presignedResponse.data;
156158

157159
if (hintFiles.length > 0) {
158160
await Promise.all(

0 commit comments

Comments
 (0)