Display delete status errors

This commit is contained in:
tusooa 2023-01-20 12:33:19 -05:00
parent 0d6435261e
commit d1876503bc
No known key found for this signature in database
GPG Key ID: 7B467EDE43A08224
3 changed files with 16 additions and 4 deletions

View File

@ -844,6 +844,7 @@
"favorites": "Favorites",
"repeats": "Repeats",
"delete": "Delete status",
"delete_error": "Error deleting status: {0}",
"edit": "Edit status",
"edited_at": "(last edited {time})",
"pin": "Pin on profile",

View File

@ -615,9 +615,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]

View File

@ -923,8 +923,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'
})
}