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

                      
                    
 
 

                                                                              









                                                                                   
export interface ComponentPagination {
  currentPage: number
  itemsPerPage: number
  totalItems: number
}

export type ComponentPaginationLight = Omit<ComponentPagination, 'totalItems'>

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
}