Display delete status errors
This commit is contained in:
parent
e2dc1e7999
commit
818b424255
3 changed files with 16 additions and 4 deletions
|
@ -970,6 +970,7 @@
|
|||
"collapse_attachments": "Collapse attachments",
|
||||
"copy_link": "Copy link to post",
|
||||
"delete": "Delete post",
|
||||
"delete_error": "Error deleting status: {0}",
|
||||
"delete_confirm": "Do you really want to delete this post?",
|
||||
"delete_confirm_accept_button": "Yes, delete it",
|
||||
"delete_confirm_cancel_button": "No, keep it",
|
||||
|
|
|
@ -616,9 +616,19 @@ const statuses = {
|
|||
fetchStatusHistory ({ rootState, dispatch }, status) {
|
||||
return apiService.fetchStatusHistory({ status })
|
||||
},
|
||||
deleteStatus ({ rootState, commit }, status) {
|
||||
commit('setDeleted', { status })
|
||||
deleteStatus ({ rootState, commit, dispatch }, status) {
|
||||
apiService.deleteStatus({ id: status.id, credentials: rootState.users.currentUser.credentials })
|
||||
.then((_) => {
|
||||
commit('setDeleted', { status })
|
||||
})
|
||||
.catch((e) => {
|
||||
dispatch('pushGlobalNotice', {
|
||||
level: 'error',
|
||||
messageKey: 'status.delete_error',
|
||||
messageArgs: [e.message],
|
||||
timeout: 5000
|
||||
})
|
||||
})
|
||||
},
|
||||
deleteStatusById ({ rootState, commit }, id) {
|
||||
const status = rootState.statuses.allStatusesObject[id]
|
||||
|
|
|
@ -981,8 +981,9 @@ const editStatus = ({
|
|||
}
|
||||
|
||||
const deleteStatus = ({ id, credentials }) => {
|
||||
return fetch(MASTODON_DELETE_URL(id), {
|
||||
headers: authHeaders(credentials),
|
||||
return promisedRequest({
|
||||
url: MASTODON_DELETE_URL(id),
|
||||
credentials,
|
||||
method: 'DELETE'
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue