aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/remote/pods.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-07-05 13:26:25 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-07-05 14:14:16 +0200
commit6fcd19ba737f1f5614a56c6925adb882dea43b8d (patch)
tree3365a96d82bc7f00ae504a568725c8e914150cf8 /server/controllers/api/remote/pods.ts
parent5fe7e898316e18369c3e1aba307b55077adc7bfb (diff)
downloadPeerTube-6fcd19ba737f1f5614a56c6925adb882dea43b8d.tar.gz
PeerTube-6fcd19ba737f1f5614a56c6925adb882dea43b8d.tar.zst
PeerTube-6fcd19ba737f1f5614a56c6925adb882dea43b8d.zip
Move to promises
Closes https://github.com/Chocobozzz/PeerTube/issues/74
Diffstat (limited to 'server/controllers/api/remote/pods.ts')
-rw-r--r--server/controllers/api/remote/pods.ts20
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 @@
1import * as express from 'express' 1import * as express from 'express'
2import * as waterfall from 'async/waterfall'
3 2
4import { database as db } from '../../../initializers/database' 3import { database as db } from '../../../initializers/database'
5import { checkSignature, signatureValidator } from '../../../middlewares' 4import { checkSignature, signatureValidator } from '../../../middlewares'
@@ -24,17 +23,10 @@ export {
24function removePods (req: express.Request, res: express.Response, next: express.NextFunction) { 23function 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}