]>
Commit | Line | Data |
---|---|---|
ab998f7b | 1 | import { Component, OnInit } from '@angular/core' |
51548b31 | 2 | |
f8b2c1b4 | 3 | import { Notifier } from '@app/core' |
51548b31 | 4 | import { SortMeta } from 'primeng/primeng' |
c48e82b5 | 5 | import { ActorFollow } from '../../../../../../shared/models/actors/follow.model' |
60862425 | 6 | import { RestPagination, RestTable } from '../../../shared' |
51548b31 | 7 | import { FollowService } from '../shared' |
b1d40cff | 8 | import { I18n } from '@ngx-translate/i18n-polyfill' |
51548b31 C |
9 | |
10 | @Component({ | |
11 | selector: 'my-followers-list', | |
12 | templateUrl: './followers-list.component.html', | |
13 | styleUrls: [ './followers-list.component.scss' ] | |
14 | }) | |
ab998f7b | 15 | export class FollowersListComponent extends RestTable implements OnInit { |
c48e82b5 | 16 | followers: ActorFollow[] = [] |
51548b31 C |
17 | totalRecords = 0 |
18 | rowsPerPage = 10 | |
19 | sort: SortMeta = { field: 'createdAt', order: 1 } | |
20 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | |
21 | ||
22 | constructor ( | |
f8b2c1b4 | 23 | private notifier: Notifier, |
b1d40cff C |
24 | private followService: FollowService, |
25 | private i18n: I18n | |
51548b31 C |
26 | ) { |
27 | super() | |
28 | } | |
29 | ||
ab998f7b | 30 | ngOnInit () { |
24b9417c | 31 | this.initialize() |
ab998f7b C |
32 | } |
33 | ||
51548b31 | 34 | protected loadData () { |
16c07398 | 35 | this.followService.getFollowers(this.pagination, this.sort, this.search) |
51548b31 C |
36 | .subscribe( |
37 | resultList => { | |
38 | this.followers = resultList.data | |
39 | this.totalRecords = resultList.total | |
40 | }, | |
41 | ||
f8b2c1b4 | 42 | err => this.notifier.error(err.message) |
51548b31 C |
43 | ) |
44 | } | |
45 | } |