diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-27 16:11:53 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-27 16:11:53 +0100 |
commit | 4635f59d7c3fea4b97029f10886c62fdf38b2084 (patch) | |
tree | d97357a00042bbfb33c4177ee24c01171d28dfce /client/src/app/shared/rest | |
parent | ea44f375f5d3da06ca0aebfe871b9f924a26ec29 (diff) | |
download | PeerTube-4635f59d7c3fea4b97029f10886c62fdf38b2084.tar.gz PeerTube-4635f59d7c3fea4b97029f10886c62fdf38b2084.tar.zst PeerTube-4635f59d7c3fea4b97029f10886c62fdf38b2084.zip |
Add video comment components
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 | } |