fix: 修改pageSize和pageIndex的默认值
This commit is contained in:
@@ -28,7 +28,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
async getActions (req, res) {
|
async getActions (req, res) {
|
||||||
const { userId } = res.locals.user;
|
const { userId } = res.locals.user;
|
||||||
const { pageIndex = 0, pageSize = 0 } = req.query;
|
const { pageIndex = 1, pageSize = 0 } = req.query;
|
||||||
return await Action.find({
|
return await Action.find({
|
||||||
userId
|
userId
|
||||||
}, actionFilter).skip((pageIndex - 1) * pageSize).limit(pageSize)
|
}, actionFilter).skip((pageIndex - 1) * pageSize).limit(pageSize)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ module.exports = {
|
|||||||
res.locals.user = deToken.data;
|
res.locals.user = deToken.data;
|
||||||
// 换发新token,存在问题:如果上一个token没过期,其他人截获了的话,会不会被盗用?
|
// 换发新token,存在问题:如果上一个token没过期,其他人截获了的话,会不会被盗用?
|
||||||
res.set('token', createToken({
|
res.set('token', createToken({
|
||||||
userId: deToken.userId
|
userId: deToken.data.userId
|
||||||
}, JWT_SECRET, {}));
|
}, JWT_SECRET, {}));
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user