refactor
This commit is contained in:
@ -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}`)))
|
||||
|
Reference in New Issue
Block a user