-
Notifications
You must be signed in to change notification settings - Fork 150
Open
Description
Hi,
I want to upload multiple files.
My problem is, my function print "succedd up" and not reach "console.log('ok')"
Here is my code
Thanks for reply
import {
RNS3
} from 'react-native-aws3'
export const UPLOAD = (data, exit, progress, success, error) => {
return async() => {
let echec = 0
let array = []
const options = {
...
}
Promise.all(
data.forEach(async(item) => {
RNS3
.put(item, options)
.progress(({ loaded, total }) => {
progress(Math.round((loaded * 100) / total))
})
.then(response => {
if (response.status === options.successActionStatus) {
console.log('succedd up')
array.push({
file: item.name,
id: item.article
})
} else {
console.log('error up')
echec++
}
})
})
)
if (data.length === array.length) {
console.log('ok')
success(array)
} else if (data.length === echec) {
console.log('ko1')
error({
message: 'Tout en erreur'
})
} else {
console.log('ko2')
error({
message: 'Quelques erreurs'
})
}
}
}
Metadata
Metadata
Assignees
Labels
No labels