F #3951: fix delete provider (#633)

Signed-off-by: Jorge Lobo <jlobo@opennebula.io>
This commit is contained in:
Jorge Miguel Lobo Escalona authored and GitHub committed 2021-01-13 15:52:18 +01:00
1 parent 45a4f2fbbc
commit 436613ef23
1 file changed
+6 -4
@@ -155,10 +155,12 @@ const deleteProvider = (res = {}, next = () => undefined, params = {}, userData
const executedCommand = executeCommand(defaultCommandProvider, paramsCommand)
const data = executedCommand.data || ''
try {
if (executedCommand) {
res.locals.httpCode = httpResponse(ok)
} else {
res.locals.httpCode = httpResponse(internalServerError, data)
if (executedCommand && executedCommand.success) {
if(executedCommand.data.length === 0){
res.locals.httpCode = httpResponse(ok)
} else {
res.locals.httpCode = httpResponse(internalServerError, '', executedCommand.data)
}
}
next()
return