diff options
Diffstat (limited to 'server/controllers/api/remote/pods.ts')
-rw-r--r-- | server/controllers/api/remote/pods.ts | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/server/controllers/api/remote/pods.ts b/server/controllers/api/remote/pods.ts index b0d6642c1..6319957d3 100644 --- a/server/controllers/api/remote/pods.ts +++ b/server/controllers/api/remote/pods.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import * as waterfall from 'async/waterfall' | ||
3 | 2 | ||
4 | import { database as db } from '../../../initializers/database' | 3 | import { database as db } from '../../../initializers/database' |
5 | import { checkSignature, signatureValidator } from '../../../middlewares' | 4 | import { checkSignature, signatureValidator } from '../../../middlewares' |
@@ -24,17 +23,10 @@ export { | |||
24 | function removePods (req: express.Request, res: express.Response, next: express.NextFunction) { | 23 | function removePods (req: express.Request, res: express.Response, next: express.NextFunction) { |
25 | const host = req.body.signature.host | 24 | const host = req.body.signature.host |
26 | 25 | ||
27 | waterfall([ | 26 | db.Pod.loadByHost(host) |
28 | function loadPod (callback) { | 27 | .then(pod => { |
29 | db.Pod.loadByHost(host, callback) | 28 | return pod.destroy() |
30 | }, | 29 | }) |
31 | 30 | .then(() => res.type('json').status(204).end()) | |
32 | function deletePod (pod, callback) { | 31 | .catch(err => next(err)) |
33 | pod.destroy().asCallback(callback) | ||
34 | } | ||
35 | ], function (err) { | ||
36 | if (err) return next(err) | ||
37 | |||
38 | return res.type('json').status(204).end() | ||
39 | }) | ||
40 | } | 32 | } |