Show alert if attachment upload fails
This commit is contained in:
parent
ccffafea21
commit
7d999c18a6
2 changed files with 13 additions and 5 deletions
|
@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
### Changed
|
||||
|
||||
- Show alert if publishing of reply fails.
|
||||
- Show alert if attachment upload fails.
|
||||
|
||||
### Fixed
|
||||
|
||||
|
|
|
@ -265,11 +265,18 @@ async function addAttachment(file: File) {
|
|||
isAttachmentLoading = true
|
||||
const imageDataUrl = await fileToDataUrl(file)
|
||||
const imageData = dataUrlToBase64(imageDataUrl)
|
||||
const attachment = await uploadAttachment(
|
||||
ensureAuthToken(),
|
||||
imageData.data,
|
||||
imageData.mediaType,
|
||||
)
|
||||
let attachment
|
||||
try {
|
||||
attachment = await uploadAttachment(
|
||||
ensureAuthToken(),
|
||||
imageData.data,
|
||||
imageData.mediaType,
|
||||
)
|
||||
} catch (error: any) {
|
||||
isAttachmentLoading = false
|
||||
alert(error.message)
|
||||
return
|
||||
}
|
||||
attachments.push(attachment)
|
||||
isAttachmentLoading = false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue