Skip to content

Commit 7c735a4

Browse files
committed
(demo) fix multiple files server upload
1 parent 724b0b0 commit 7c735a4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

demo/src/ChatContainer.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,9 @@ export default {
484484
const { id } = await messagesRef(roomId).add(message)
485485
486486
if (files) {
487-
files.forEach(file => {
488-
this.uploadFile({ file, messageId: id, roomId })
489-
})
487+
for (let index = 0; index < files.length; index++) {
488+
await this.uploadFile({ file: files[index], messageId: id, roomId })
489+
}
490490
}
491491
492492
roomsRef.doc(roomId).update({ lastUpdated: new Date() })
@@ -507,9 +507,11 @@ export default {
507507
.update(newMessage)
508508
509509
if (files) {
510-
files.forEach(file => {
511-
if (file?.blob) this.uploadFile({ file, messageId, roomId })
512-
})
510+
for (let index = 0; index < files.length; index++) {
511+
if (files[index]?.blob) {
512+
await this.uploadFile({ file: files[index], messageId, roomId })
513+
}
514+
}
513515
}
514516
},
515517

0 commit comments

Comments
 (0)