Pinafore-Web-Client-Frontend/src/routes/_actions/reportStatuses.js

15 lines
592 B
JavaScript
Raw Normal View History

import { store } from '../_store/store.js'
import { toast } from '../_components/toast/toast.js'
import { report } from '../_api/report.js'
import { formatIntl } from '../_utils/formatIntl.js'
export async function reportStatuses (account, statusIds, comment, forward) {
2019-08-03 22:49:37 +02:00
const { currentInstance, accessToken } = store.get()
try {
await report(currentInstance, accessToken, account.id, statusIds, comment, forward)
/* no await */ toast.say('intl.submittedReport')
} catch (e) {
/* no await */ toast.say(formatIntl('intl.failedToReport', { error: (e.message || '') }))
}
}