fix: fix error message on media upload (#1959)

This commit is contained in:
Nolan Lawson 2021-02-15 19:23:01 -08:00 committed by GitHub
parent c209fb23d5
commit ba3b76f769
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,7 @@ import { uploadMedia } from '../_api/media'
import { toast } from '../_components/toast/toast' import { toast } from '../_components/toast/toast'
import { scheduleIdleTask } from '../_utils/scheduleIdleTask' import { scheduleIdleTask } from '../_utils/scheduleIdleTask'
import { setCachedMediaFile } from '../_utils/mediaUploadFileCache' import { setCachedMediaFile } from '../_utils/mediaUploadFileCache'
import { formatIntl } from '../_utils/formatIntl'
export async function doMediaUpload (realm, file) { export async function doMediaUpload (realm, file) {
const { currentInstance, accessToken } = store.get() const { currentInstance, accessToken } = store.get()
@ -25,7 +26,7 @@ export async function doMediaUpload (realm, file) {
scheduleIdleTask(() => store.save()) scheduleIdleTask(() => store.save())
} catch (e) { } catch (e) {
console.error(e) console.error(e)
/* no await */ toast.say('intl.failedToUploadMedia', { error: (e.message || '') }) /* no await */ toast.say(formatIntl('intl.failedToUploadMedia', { error: (e.message || '') }))
} finally { } finally {
store.set({ uploadingMedia: false }) store.set({ uploadingMedia: false })
} }