F #3951: Fix requests provisions (#478)

This commit is contained in:
Sergio Betanzos authored and GitHub committed 2020-11-25 16:47:11 +01:00
1 parent 52193ac74e
commit fd9d87a450
2 files changed
+9 -3

No files matched your search

@@ -166,7 +166,7 @@ export default function useOpennebula () {
const deleteProvision = useCallback(
({ id }) =>
serviceProvision
.deleteProvider({ id })
.deleteProvision({ id })
.then(() => dispatch(enqueueSuccess(`Provision deleted - ID: ${id}`)))
.catch(err => dispatch(enqueueError(err ?? 'Error DELETE provision')))
, [dispatch, provisions]
@@ -54,7 +54,10 @@ export const createProvision = ({ data = {} }) =>
method: POST,
error: err => err?.message
}).then(res => {
if (!res?.id || res?.id !== httpCodes.ok.id) throw res
if (!res?.id || res?.id !== httpCodes.ok.id) {
if (res?.id === httpCodes.accepted.id) return res
throw res
}
return res?.data ?? {}
})
@@ -64,7 +67,10 @@ export const deleteProvision = ({ id }) =>
method: DELETE,
error: err => err?.message
}).then(res => {
if (!res?.id || res?.id !== httpCodes.ok.id) throw res
if (!res?.id || res?.id !== httpCodes.ok.id) {
if (res?.id === httpCodes.accepted.id) return res
throw res
}
return res?.data ?? {}
})