feat: finish errorCommands pagination

This commit is contained in:
Chen, Tai-Lin committed 2023-12-21 16:31:34 +08:00
1 parent 8c634c8115
commit bc0055781e
6 files changed
+59 -41

No files matched your search

+1 -8
View File
@@ -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')