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
|
### Changed
|
||||||
|
|
||||||
- Show alert if publishing of reply fails.
|
- Show alert if publishing of reply fails.
|
||||||
|
- Show alert if attachment upload fails.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|
|
@ -265,11 +265,18 @@ async function addAttachment(file: File) {
|
||||||
isAttachmentLoading = true
|
isAttachmentLoading = true
|
||||||
const imageDataUrl = await fileToDataUrl(file)
|
const imageDataUrl = await fileToDataUrl(file)
|
||||||
const imageData = dataUrlToBase64(imageDataUrl)
|
const imageData = dataUrlToBase64(imageDataUrl)
|
||||||
const attachment = await uploadAttachment(
|
let attachment
|
||||||
ensureAuthToken(),
|
try {
|
||||||
imageData.data,
|
attachment = await uploadAttachment(
|
||||||
imageData.mediaType,
|
ensureAuthToken(),
|
||||||
)
|
imageData.data,
|
||||||
|
imageData.mediaType,
|
||||||
|
)
|
||||||
|
} catch (error: any) {
|
||||||
|
isAttachmentLoading = false
|
||||||
|
alert(error.message)
|
||||||
|
return
|
||||||
|
}
|
||||||
attachments.push(attachment)
|
attachments.push(attachment)
|
||||||
isAttachmentLoading = false
|
isAttachmentLoading = false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue