diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-05-13 20:10:02 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-05-13 20:10:02 +0200 |
commit | 3fe81fa75eef5320876441539ab89988a04a6c49 (patch) | |
tree | 8b27ba4b0c367a15ec82600098516fc8378432e6 /server/middlewares/pagination.js | |
parent | fbf1134e3e6b386c9ec5a3946c61f3faf84397fb (diff) | |
download | PeerTube-3fe81fa75eef5320876441539ab89988a04a6c49.tar.gz PeerTube-3fe81fa75eef5320876441539ab89988a04a6c49.tar.zst PeerTube-3fe81fa75eef5320876441539ab89988a04a6c49.zip |
Move the count of results for the pagination in constants module
Diffstat (limited to 'server/middlewares/pagination.js')
-rw-r--r-- | server/middlewares/pagination.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/server/middlewares/pagination.js b/server/middlewares/pagination.js index 2a426ec28..9fa43f008 100644 --- a/server/middlewares/pagination.js +++ b/server/middlewares/pagination.js | |||
@@ -1,5 +1,7 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const constants = require('../initializers/constants') | ||
4 | |||
3 | const paginationMiddleware = { | 5 | const paginationMiddleware = { |
4 | setPagination: setPagination | 6 | setPagination: setPagination |
5 | } | 7 | } |
@@ -7,7 +9,7 @@ const paginationMiddleware = { | |||
7 | function setPagination (req, res, next) { | 9 | function setPagination (req, res, next) { |
8 | if (!req.query.start) req.query.start = 0 | 10 | if (!req.query.start) req.query.start = 0 |
9 | else req.query.start = parseInt(req.query.start) | 11 | else req.query.start = parseInt(req.query.start) |
10 | if (!req.query.count) req.query.count = 15 | 12 | if (!req.query.count) req.query.count = constants.PAGINATION_COUNT_DEFAULT |
11 | else req.query.count = parseInt(req.query.count) | 13 | else req.query.count = parseInt(req.query.count) |
12 | 14 | ||
13 | return next() | 15 | return next() |