mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
paginatedList: only return next when page isn't empty
This commit is contained in:
parent
97d629cf07
commit
adcaad2863
1 changed files with 2 additions and 1 deletions
|
|
@ -210,9 +210,10 @@ function paginatedList(
|
||||||
headers: HeaderRecord = {},
|
headers: HeaderRecord = {},
|
||||||
) {
|
) {
|
||||||
const link = buildListLinkHeader(c.req.url, params);
|
const link = buildListLinkHeader(c.req.url, params);
|
||||||
|
const hasMore = entities.length > 0;
|
||||||
|
|
||||||
if (link) {
|
if (link) {
|
||||||
headers.link = link;
|
headers.link = hasMore ? link : link.split(', ').find((link) => link.endsWith('; rel="prev"'))!;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter out undefined entities.
|
// Filter out undefined entities.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue