This commit is contained in:
Sam
2019-01-18 19:34:38 +01:00
parent 012c83121d
commit f14d5a1dbf
4 changed files with 27 additions and 25 deletions

View File

@ -27,7 +27,7 @@ export const getOrUpdateData = (action, target, data) => dispatch => {
if (ret.status === 'success') {
dispatch(setData(target, ret.data))
} else {
dispatch(setError(`${target}: ${ret.message}`))
dispatch(setError(`${target}: ${ret.message || ret.status}`))
}
})
.catch(error => dispatch(setError(`${target}: ${error}`)))
@ -54,7 +54,7 @@ export const deleteData = (target, id) => dispatch => {
if (ret.status === 204) {
history.push(`/admin/${target}`)
} else {
dispatch(setError(`${target}: ${ret.message}`))
dispatch(setError(`${target}: ${ret.message || ret.status}`))
}
})
.catch(error => dispatch(setError(`${target}: ${error}`)))