]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/videos/blacklist.ts
Async signature and various fixes
[github/Chocobozzz/PeerTube.git] / server / controllers / api / videos / blacklist.ts
index 4b42fc2d703c17a3eb867f2db8b5f4fd4166a15d..e4be6f0f9cb8d11d7763dfbd4a7d1633e50ba946 100644 (file)
@@ -32,12 +32,10 @@ function addVideoToBlacklist (req: express.Request, res: express.Response, next:
     videoId: videoInstance.id
   }
 
-  db.BlacklistedVideo.create(toCreate).asCallback(function (err) {
-    if (err) {
+  db.BlacklistedVideo.create(toCreate)
+    .then(() => res.type('json').status(204).end())
+    .catch(err => {
       logger.error('Errors when blacklisting video ', { error: err })
       return next(err)
-    }
-
-    return res.type('json').status(204).end()
-  })
+    })
 }