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