mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-03-21 11:35:54 +00:00
Refactor app:rm with async
This commit is contained in:
parent
37c68118db
commit
0697510f38
@ -1,4 +1,5 @@
|
||||
_ = require('lodash')
|
||||
async = require('async')
|
||||
device = require('../device/device')
|
||||
table = require('../table/table')
|
||||
server = require('../server/server')
|
||||
@ -41,7 +42,17 @@ exports.restart = authHooks.failIfNotLoggedIn (id) ->
|
||||
throw error if error?
|
||||
|
||||
exports.remove = authHooks.failIfNotLoggedIn (id) ->
|
||||
widgets.confirmRemoval 'application', (error, confirmed) ->
|
||||
return if not confirmed
|
||||
applicationModel.remove(id).catch (error) ->
|
||||
throw error if error?
|
||||
async.waterfall [
|
||||
|
||||
(callback) ->
|
||||
widgets.confirmRemoval('application', callback)
|
||||
|
||||
(confirmed, callback) ->
|
||||
return callback() if not confirmed
|
||||
|
||||
applicationModel.remove(id).then ->
|
||||
return callback()
|
||||
.catch(callback)
|
||||
|
||||
], (error) ->
|
||||
throw error if error?
|
||||
|
Loading…
x
Reference in New Issue
Block a user