mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix return error if chunk failed to upload
This commit is contained in:
@@ -70,13 +70,23 @@ class UploadFileUseCase {
|
||||
let connection = true
|
||||
let errorMessage: UploadError.noConnection | UploadError.slow
|
||||
|
||||
for (let index = 1; ( (index <= PublicationAttachmentEntity.chucksManager.chunks.totalChunks) ); index++) {
|
||||
for (let index = 1; ( (index <= PublicationAttachmentEntity.chucksManager.chunks.totalChunks) && connection ); index++) {
|
||||
const needUpload = PublicationAttachmentEntity.chucksManager.needToUploadChunkIndex(index)
|
||||
|
||||
if(needUpload) {
|
||||
|
||||
const request = readAndUploadChunk(index).then(async(uploadRequest) => {
|
||||
|
||||
if(uploadRequest.isErr()) {
|
||||
connection = false
|
||||
const pingRequest = await this.CMAPIService.ping()
|
||||
if( pingRequest.isErr()) {
|
||||
errorMessage = UploadError.noConnection
|
||||
} else {
|
||||
errorMessage = UploadError.slow
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
allRequest.push(request)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user