Display delete status errors
This commit is contained in:
parent
0d6435261e
commit
d1876503bc
@ -844,6 +844,7 @@
|
|||||||
"favorites": "Favorites",
|
"favorites": "Favorites",
|
||||||
"repeats": "Repeats",
|
"repeats": "Repeats",
|
||||||
"delete": "Delete status",
|
"delete": "Delete status",
|
||||||
|
"delete_error": "Error deleting status: {0}",
|
||||||
"edit": "Edit status",
|
"edit": "Edit status",
|
||||||
"edited_at": "(last edited {time})",
|
"edited_at": "(last edited {time})",
|
||||||
"pin": "Pin on profile",
|
"pin": "Pin on profile",
|
||||||
|
@ -615,9 +615,19 @@ const statuses = {
|
|||||||
fetchStatusHistory ({ rootState, dispatch }, status) {
|
fetchStatusHistory ({ rootState, dispatch }, status) {
|
||||||
return apiService.fetchStatusHistory({ status })
|
return apiService.fetchStatusHistory({ status })
|
||||||
},
|
},
|
||||||
deleteStatus ({ rootState, commit }, status) {
|
deleteStatus ({ rootState, commit, dispatch }, status) {
|
||||||
commit('setDeleted', { status })
|
|
||||||
apiService.deleteStatus({ id: status.id, credentials: rootState.users.currentUser.credentials })
|
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) {
|
deleteStatusById ({ rootState, commit }, id) {
|
||||||
const status = rootState.statuses.allStatusesObject[id]
|
const status = rootState.statuses.allStatusesObject[id]
|
||||||
|
@ -923,8 +923,9 @@ const editStatus = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const deleteStatus = ({ id, credentials }) => {
|
const deleteStatus = ({ id, credentials }) => {
|
||||||
return fetch(MASTODON_DELETE_URL(id), {
|
return promisedRequest({
|
||||||
headers: authHeaders(credentials),
|
url: MASTODON_DELETE_URL(id),
|
||||||
|
credentials,
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user