Skip to content

Commit

Permalink
fix(system-client): fix pagination error;
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Sep 6, 2021
1 parent 9e7b88a commit 308ad8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions packages/system-server/src/router/function/get.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @Author: Maslow<wangfugen@126.com>
* @Date: 2021-08-30 16:51:19
* @LastEditTime: 2021-09-03 20:30:19
* @LastEditTime: 2021-09-06 16:37:34
* @Description:
*/

Expand Down Expand Up @@ -30,9 +30,9 @@ export async function handleGetFunctions(req: Request, res: Response) {
}

// build query object
const { keyword, tag, status } = req.body
const limit = req.body?.limit ?? 10
const page = req.body?.page ?? 1
const { keyword, tag, status } = req.query
const limit = Number(req.query?.limit || 10)
const page = Number(req.query?.page || 1)

const query = {
appid: app.appid
Expand All @@ -50,7 +50,7 @@ export async function handleGetFunctions(req: Request, res: Response) {
}

if (status) {
query['status'] = status
query['status'] = Number(status)
}

const coll = db.collection(Constants.cn.functions)
Expand Down
8 changes: 4 additions & 4 deletions packages/system-server/src/router/policy/get.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @Author: Maslow<wangfugen@126.com>
* @Date: 2021-09-03 23:09:23
* @LastEditTime: 2021-09-03 23:19:58
* @LastEditTime: 2021-09-06 15:58:15
* @Description:
*/

Expand Down Expand Up @@ -31,9 +31,9 @@ export async function handleGetPolicies(req: Request, res: Response) {
}

// build query object
const { keyword } = req.body
const limit = req.body?.limit ?? 10
const page = req.body?.page ?? 1
const { keyword } = req.query
const limit = Number(req.query?.limit || 10)
const page = Number(req.query?.page || 1)

const query = {
appid: app.appid
Expand Down

0 comments on commit 308ad8a

Please sign in to comment.