aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/rest
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/rest')
-rw-r--r--client/src/app/shared/rest/component-pagination.model.ts5
-rw-r--r--client/src/app/shared/rest/rest.service.ts7
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 @@
1export 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 @@
1import { Injectable } from '@angular/core' 1import { Injectable } from '@angular/core'
2import { HttpParams } from '@angular/common/http' 2import { HttpParams } from '@angular/common/http'
3import { SortMeta } from 'primeng/components/common/sortmeta' 3import { SortMeta } from 'primeng/components/common/sortmeta'
4import { ComponentPagination } from './component-pagination.model'
4 5
5import { RestPagination } from './rest-pagination' 6import { 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}