aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/src/app/shared/rest/component-pagination.model.ts
blob: 85160d44559c83ff9d539d55654c8424d5c160de (plain) (tree)
1
2
3
4
5
                                      

                      
                     
 










                                                                                   
export interface ComponentPagination {
  currentPage: number
  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
}