Skip to content

Commit

Permalink
fix: 이미지 업로드 시 비동기 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ArpaAP committed Aug 5, 2024
1 parent 2a303c6 commit 3ea88f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/web/src/app/api/upload/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function POST(request: NextRequest) {

const fileNames: string[] = []

images.forEach(async (image) => {
for (let image of images) {
const fileExtension = image.name.split('.').pop()
const fileName = `${v4()}.${fileExtension}`
const fileRef = ref(storage, `images/${fileName}`)
Expand All @@ -52,7 +52,7 @@ export async function POST(request: NextRequest) {
console.log(fileName)

await uploadBytes(fileRef, image)
})
}

const meal = await prisma.meal.create({
data: {
Expand Down

0 comments on commit 3ea88f7

Please sign in to comment.