From 2df82d42cb57783cd90ccfc11fc8ffe4b95ebb70 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 18 Mar 2016 16:28:09 +0100 Subject: Change api output for videos --- server/middlewares/reqValidators/videos.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'server/middlewares/reqValidators') diff --git a/server/middlewares/reqValidators/videos.js b/server/middlewares/reqValidators/videos.js index 4057e72cd..12e878e81 100644 --- a/server/middlewares/reqValidators/videos.js +++ b/server/middlewares/reqValidators/videos.js @@ -35,11 +35,10 @@ function videosGet (req, res, next) { res.sendStatus(500) } - videos.getVideoState(video, function (state) { - if (state.exist === false) return res.status(404).send('Video not found') + const state = videos.getVideoState(video) + if (state.exist === false) return res.status(404).send('Video not found') - next() - }) + next() }) }) } @@ -56,12 +55,11 @@ function videosRemove (req, res, next) { res.sendStatus(500) } - videos.getVideoState(video, function (state) { - if (state.exist === false) return res.status(404).send('Video not found') - else if (state.owned === false) return res.status(403).send('Cannot remove video of another pod') + const state = videos.getVideoState(video) + if (state.exist === false) return res.status(404).send('Video not found') + else if (state.owned === false) return res.status(403).send('Cannot remove video of another pod') - next() - }) + next() }) }) } -- cgit v1.2.3