From faab3a8453e2af92f95518e55e00293ac140b6e8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 26 Oct 2017 08:51:11 +0200 Subject: Add migration script for channels --- server/controllers/api/users.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'server/controllers') diff --git a/server/controllers/api/users.ts b/server/controllers/api/users.ts index b49d37d4e..18a094f03 100644 --- a/server/controllers/api/users.ts +++ b/server/controllers/api/users.ts @@ -158,16 +158,14 @@ async function getUserVideoRating (req: express.Request, res: express.Response, const videoId = +req.params.videoId const userId = +res.locals.oauth.token.User.id - db.UserVideoRate.load(userId, videoId, null) - .then(ratingObj => { - const rating = ratingObj ? ratingObj.type : 'none' - const json: FormattedUserVideoRate = { - videoId, - rating - } - res.json(json) - }) - .catch(err => next(err)) + const ratingObj = await db.UserVideoRate.load(userId, videoId, null) + const rating = ratingObj ? ratingObj.type : 'none' + + const json: FormattedUserVideoRate = { + videoId, + rating + } + res.json(json) } async function listUsers (req: express.Request, res: express.Response, next: express.NextFunction) { -- cgit v1.2.3