diff options
Diffstat (limited to 'client/src/app/shared/rest')
-rw-r--r-- | client/src/app/shared/rest/component-pagination.model.ts | 4 | ||||
-rw-r--r-- | client/src/app/shared/rest/rest.service.ts | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/client/src/app/shared/rest/component-pagination.model.ts b/client/src/app/shared/rest/component-pagination.model.ts index 85160d445..bcb73ed0f 100644 --- a/client/src/app/shared/rest/component-pagination.model.ts +++ b/client/src/app/shared/rest/component-pagination.model.ts | |||
@@ -1,9 +1,11 @@ | |||
1 | export interface ComponentPagination { | 1 | export interface ComponentPagination { |
2 | currentPage: number | 2 | currentPage: number |
3 | itemsPerPage: number | 3 | itemsPerPage: number |
4 | totalItems?: number | 4 | totalItems: number |
5 | } | 5 | } |
6 | 6 | ||
7 | export type ComponentPaginationLight = Omit<ComponentPagination, 'totalItems'> | ||
8 | |||
7 | export function hasMoreItems (componentPagination: ComponentPagination) { | 9 | export function hasMoreItems (componentPagination: ComponentPagination) { |
8 | // No results | 10 | // No results |
9 | if (componentPagination.totalItems === 0) return false | 11 | if (componentPagination.totalItems === 0) return false |
diff --git a/client/src/app/shared/rest/rest.service.ts b/client/src/app/shared/rest/rest.service.ts index e6d4e6e5e..16bb6d82c 100644 --- a/client/src/app/shared/rest/rest.service.ts +++ b/client/src/app/shared/rest/rest.service.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Injectable } from '@angular/core' | 1 | import { Injectable } from '@angular/core' |
2 | import { HttpParams } from '@angular/common/http' | 2 | import { HttpParams } from '@angular/common/http' |
3 | import { SortMeta } from 'primeng/components/common/sortmeta' | 3 | import { SortMeta } from 'primeng/components/common/sortmeta' |
4 | import { ComponentPagination } from './component-pagination.model' | 4 | import { ComponentPagination, ComponentPaginationLight } from './component-pagination.model' |
5 | 5 | ||
6 | import { RestPagination } from './rest-pagination' | 6 | import { RestPagination } from './rest-pagination' |
7 | 7 | ||
@@ -47,7 +47,7 @@ export class RestService { | |||
47 | return params | 47 | return params |
48 | } | 48 | } |
49 | 49 | ||
50 | componentPaginationToRestPagination (componentPagination: ComponentPagination): RestPagination { | 50 | componentPaginationToRestPagination (componentPagination: ComponentPaginationLight): RestPagination { |
51 | const start: number = (componentPagination.currentPage - 1) * componentPagination.itemsPerPage | 51 | const start: number = (componentPagination.currentPage - 1) * componentPagination.itemsPerPage |
52 | const count: number = componentPagination.itemsPerPage | 52 | const count: number = componentPagination.itemsPerPage |
53 | 53 | ||