mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 03:20:12 +08:00
feat: add pagination buttons
This commit is contained in:
1 parent
fa36b63fbe
commit
3b68693177
8 files changed
+52
-19
No files matched your search
@@ -8,12 +8,15 @@ export async function commandListController(req, res) {
|
||||
const itemsPerPage = 100
|
||||
|
||||
try {
|
||||
const payload = await errorCommands(
|
||||
new Pagination(order, itemsPerPage, nextKey)
|
||||
)
|
||||
const pagination = new Pagination(order, itemsPerPage, nextKey)
|
||||
const payload = await errorCommands(pagination)
|
||||
const newNextKey = payload[payload.length - 1]?._id
|
||||
|
||||
res.render('commands', { errorCommands: payload, nextKey: newNextKey })
|
||||
res.render('commands', {
|
||||
errorCommands: payload,
|
||||
nextKey: newNextKey,
|
||||
order: pagination.getOrder(),
|
||||
})
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
res.status(500).send('Error fetching data')
|
||||
|
||||
Reference in new issue
Block a user