fix: 修改pageSize和pageIndex的默认值

This commit is contained in:
chaosBreaking
2019-09-07 15:32:56 +08:00
parent cc4e4eb7f7
commit 403da58e78
2 changed files with 2 additions and 2 deletions

View File

@@ -28,7 +28,7 @@ module.exports = {
},
async getActions (req, res) {
const { userId } = res.locals.user;
const { pageIndex = 0, pageSize = 0 } = req.query;
const { pageIndex = 1, pageSize = 0 } = req.query;
return await Action.find({
userId
}, actionFilter).skip((pageIndex - 1) * pageSize).limit(pageSize)

View File

@@ -13,7 +13,7 @@ module.exports = {
res.locals.user = deToken.data;
// 换发新token存在问题如果上一个token没过期其他人截获了的话会不会被盗用
res.set('token', createToken({
userId: deToken.userId
userId: deToken.data.userId
}, JWT_SECRET, {}));
return next();
}