Problem: error when paging without items
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing

Solution: check if items are available
This commit is contained in:
Peter Stuifzand 2022-04-17 00:15:35 +02:00
parent 7da53da8e1
commit e9c69c8eac
Signed by: peter
GPG Key ID: 374322D56E5209E8

View File

@ -180,8 +180,7 @@ WHERE "channel_id" = $1
return tl, err
}
// TODO: should only be set of there are more items available
if hasMoreBefore(conn, tl.Items[0].Published) {
if len(tl.Items) > 0 && hasMoreBefore(conn, tl.Items[0].Published) {
tl.Paging.Before = tl.Items[0].Published
}
if hasMoreAfter(conn, last) {