mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 03:20:12 +08:00
feat: finish errorCommands pagination
This commit is contained in:
1 parent
8c634c8115
commit
bc0055781e
6 files changed
+59
-41
No files matched your search
@@ -6,9 +6,6 @@ export async function userListController(req, res) {
|
||||
const itemsPerPage = 50
|
||||
|
||||
try {
|
||||
// const totalUsers = await userCount()
|
||||
// const maxPages = Math.ceil(totalUsers / itemsPerPage)
|
||||
|
||||
const users = await userList({
|
||||
nextKey,
|
||||
itemsPerPage,
|
||||
@@ -16,11 +13,7 @@ export async function userListController(req, res) {
|
||||
})
|
||||
const newNextKey = users[users.length - 1]?._id
|
||||
|
||||
res.render('users', {
|
||||
users,
|
||||
nextKey: newNextKey,
|
||||
// maxPages: Array.from({ length: maxPages }, (_, index) => index + 1),
|
||||
})
|
||||
res.render('users', { users, nextKey: newNextKey })
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
res.status(500).send('Error fetching user data')
|
||||
|
||||
Reference in new issue
Block a user