]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/rest/component-pagination.model.ts
tslint update
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / rest / component-pagination.model.ts
index 0b8ecc318bd7c866dfaa9d547f39c9bd93f8b573..85160d44559c83ff9d539d55654c8424d5c160de 100644 (file)
@@ -3,3 +3,14 @@ export interface ComponentPagination {
   itemsPerPage: number
   totalItems?: number
 }
+
+export function hasMoreItems (componentPagination: ComponentPagination) {
+  // No results
+  if (componentPagination.totalItems === 0) return false
+
+  // Not loaded yet
+  if (!componentPagination.totalItems) return true
+
+  const maxPage = componentPagination.totalItems / componentPagination.itemsPerPage
+  return maxPage > componentPagination.currentPage
+}