Skip to content

Commit

Permalink
Feat: first and last page links
Browse files Browse the repository at this point in the history
Signed-off-by: Kaung Zin Hein <[email protected]>
  • Loading branch information
Zen-cronic committed Feb 21, 2025
1 parent fcd1cd4 commit df47070
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/user/formats/hal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ export function collection(embeddedUsers: HalResource[], paginatedResult: Pagina
hal._links['previous'] = { href: `/user?page=${prevPage}` };
}

if(hasNextPage || hasPrevPage){
hal._links['first'] = { href: '/user?page=1' };
hal._links['last'] = { href: `/user?page=${totalPages}` };
}

if (embeddedUsers.length) {
hal._embedded = {
item: embeddedUsers
Expand Down

0 comments on commit df47070

Please sign in to comment.