Reputation: 232
I am trying to upload images to firebase storage and then when uploads finish, execute a try/catch block of codes with addDoc() command to create a doc inside fb database. The sample coding is as follows:
const abc = () => {
array.map(() => {
return uploadFilesToFb()
})
// then, when the above function finishes
createDocInFb()
}
I heard about Promises, but is there any other way of doing this? I mean, in firebase there are .then
functions but since I have a mapping I couldn't put addDoc()
after .then
of uploadFilesToFb()
. If only alternative is promises, how can I achieve that with promises?
Upvotes: 0
Views: 106