aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/users.ts18
1 files changed, 8 insertions, 10 deletions
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,
158 const videoId = +req.params.videoId 158 const videoId = +req.params.videoId
159 const userId = +res.locals.oauth.token.User.id 159 const userId = +res.locals.oauth.token.User.id
160 160
161 db.UserVideoRate.load(userId, videoId, null) 161 const ratingObj = await db.UserVideoRate.load(userId, videoId, null)
162 .then(ratingObj => { 162 const rating = ratingObj ? ratingObj.type : 'none'
163 const rating = ratingObj ? ratingObj.type : 'none' 163
164 const json: FormattedUserVideoRate = { 164 const json: FormattedUserVideoRate = {
165 videoId, 165 videoId,
166 rating 166 rating
167 } 167 }
168 res.json(json) 168 res.json(json)
169 })
170 .catch(err => next(err))
171} 169}
172 170
173async function listUsers (req: express.Request, res: express.Response, next: express.NextFunction) { 171async function listUsers (req: express.Request, res: express.Response, next: express.NextFunction) {