]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/rest/component-pagination.model.ts
85160d44559c83ff9d539d55654c8424d5c160de
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / rest / component-pagination.model.ts
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 }