Skip to content

Commit

Permalink
Allow to receive info about error in callback
Browse files Browse the repository at this point in the history
  • Loading branch information
e-marchand committed Jan 29, 2024
1 parent 1aa2625 commit ae0f6a2
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ class ActionViewModel(apiService: ApiService) : BaseViewModel() {
}

fun uploadImage(
imagesToUpload: Map<String, RequestBody?>,
imagesToUpload: Map<String, Result<RequestBody>>,
onImageUploaded: (parameterName: String, receivedId: String) -> Unit,
onImageFailed: (parameterName: String, throwable: Throwable) -> Unit,
onError: () -> Unit,
onAllUploadFinished: () -> Unit
) {
Expand All @@ -86,6 +87,9 @@ class ActionViewModel(apiService: ApiService) : BaseViewModel() {
}
}
} else {
error?.let {
onImageFailed(parameterName, it)
}
treatFailure(response, error, "ActionViewModel", ToastMessage.Type.ERROR)
onError()
}
Expand Down

0 comments on commit ae0f6a2

Please sign in to comment.