diff options
Diffstat (limited to 'client/src/app/shared/rest')
-rw-r--r-- | client/src/app/shared/rest/component-pagination.model.ts | 5 | ||||
-rw-r--r-- | client/src/app/shared/rest/rest.service.ts | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/client/src/app/shared/rest/component-pagination.model.ts b/client/src/app/shared/rest/component-pagination.model.ts new file mode 100644 index 000000000..0b8ecc318 --- /dev/null +++ b/client/src/app/shared/rest/component-pagination.model.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export interface ComponentPagination { | ||
2 | currentPage: number | ||
3 | itemsPerPage: number | ||
4 | totalItems?: number | ||
5 | } | ||
diff --git a/client/src/app/shared/rest/rest.service.ts b/client/src/app/shared/rest/rest.service.ts index a1c301050..5d5410de9 100644 --- a/client/src/app/shared/rest/rest.service.ts +++ b/client/src/app/shared/rest/rest.service.ts | |||
@@ -1,6 +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 | 5 | ||
5 | import { RestPagination } from './rest-pagination' | 6 | import { RestPagination } from './rest-pagination' |
6 | 7 | ||
@@ -31,4 +32,10 @@ export class RestService { | |||
31 | return newParams | 32 | return newParams |
32 | } | 33 | } |
33 | 34 | ||
35 | componentPaginationToRestPagination (componentPagination: ComponentPagination): RestPagination { | ||
36 | const start: number = (componentPagination.currentPage - 1) * componentPagination.itemsPerPage | ||
37 | const count: number = componentPagination.itemsPerPage | ||
38 | |||
39 | return { start, count } | ||
40 | } | ||
34 | } | 41 | } |