mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-03 05:34:23 +01:00
paginatedList: only return next when page isn't empty
This commit is contained in:
@@ -210,9 +210,10 @@ function paginatedList(
|
||||
headers: HeaderRecord = {},
|
||||
) {
|
||||
const link = buildListLinkHeader(c.req.url, params);
|
||||
const hasMore = entities.length > 0;
|
||||
|
||||
if (link) {
|
||||
headers.link = link;
|
||||
headers.link = hasMore ? link : link.split(', ').find((link) => link.endsWith('; rel="prev"'))!;
|
||||
}
|
||||
|
||||
// Filter out undefined entities.
|
||||
|
||||
Reference in New Issue
Block a user