]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/+admin/follows/followers-list/followers-list.component.ts
Prepare i18n files
[github/Chocobozzz/PeerTube.git] / client / src / app / +admin / follows / followers-list / followers-list.component.ts
CommitLineData
ab998f7b 1import { Component, OnInit } from '@angular/core'
51548b31
C
2
3import { NotificationsService } from 'angular2-notifications'
4import { SortMeta } from 'primeng/primeng'
50d6de9c 5import { AccountFollow } from '../../../../../../shared/models/actors/follow.model'
60862425 6import { RestPagination, RestTable } from '../../../shared'
51548b31
C
7import { FollowService } from '../shared'
8
9@Component({
10 selector: 'my-followers-list',
11 templateUrl: './followers-list.component.html',
12 styleUrls: [ './followers-list.component.scss' ]
13})
ab998f7b 14export class FollowersListComponent extends RestTable implements OnInit {
60862425 15 followers: AccountFollow[] = []
51548b31
C
16 totalRecords = 0
17 rowsPerPage = 10
18 sort: SortMeta = { field: 'createdAt', order: 1 }
19 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
20
21 constructor (
22 private notificationsService: NotificationsService,
23 private followService: FollowService
24 ) {
25 super()
26 }
27
ab998f7b
C
28 ngOnInit () {
29 this.loadSort()
30 }
31
51548b31
C
32 protected loadData () {
33 this.followService.getFollowers(this.pagination, this.sort)
34 .subscribe(
35 resultList => {
36 this.followers = resultList.data
37 this.totalRecords = resultList.total
38 },
39
40 err => this.notificationsService.error('Error', err.message)
41 )
42 }
43}