2018-03-14 08:36:12 -07:00
|
|
|
import { store } from '../_store/store'
|
|
|
|
import { deleteStatus } from '../_api/delete'
|
2018-12-22 15:37:51 -08:00
|
|
|
import { toast } from '../_components/toast/toast'
|
2018-12-12 23:45:52 -08:00
|
|
|
import { deleteStatus as deleteStatusLocally } from './deleteStatuses'
|
2018-03-14 08:36:12 -07:00
|
|
|
|
|
|
|
export async function doDeleteStatus (statusId) {
|
2018-04-19 09:37:05 -07:00
|
|
|
let { currentInstance, accessToken } = store.get()
|
2018-03-14 08:36:12 -07:00
|
|
|
try {
|
2018-04-19 09:37:05 -07:00
|
|
|
await deleteStatus(currentInstance, accessToken, statusId)
|
2018-12-12 23:45:52 -08:00
|
|
|
deleteStatusLocally(currentInstance, statusId)
|
2018-03-14 08:36:12 -07:00
|
|
|
toast.say('Status deleted.')
|
|
|
|
} catch (e) {
|
|
|
|
console.error(e)
|
|
|
|
toast.say('Unable to delete status: ' + (e.message || ''))
|
|
|
|
}
|
|
|
|
}
|