]>
Commit | Line | Data |
---|---|---|
1 | export interface ComponentPagination { | |
2 | currentPage: number | |
3 | itemsPerPage: number | |
4 | totalItems?: number | |
5 | } | |
6 | ||
7 | export function hasMoreItems (componentPagination: ComponentPagination) { | |
8 | // No results | |
9 | if (componentPagination.totalItems === 0) return false | |
10 | ||
11 | // Not loaded yet | |
12 | if (!componentPagination.totalItems) return true | |
13 | ||
14 | const maxPage = componentPagination.totalItems / componentPagination.itemsPerPage | |
15 | return maxPage > componentPagination.currentPage | |
16 | } |