Rename Pod -> Server
[oweals/peertube.git] / client / src / app / +admin / follows / following-list / following-list.component.ts
1 import { Component } from '@angular/core'
2 import { NotificationsService } from 'angular2-notifications'
3 import { SortMeta } from 'primeng/primeng'
4 import { AccountFollow } from '../../../../../../shared/models/accounts/follow.model'
5 import { RestPagination, RestTable } from '../../../shared'
6 import { FollowService } from '../shared'
7
8 @Component({
9   selector: 'my-followers-list',
10   templateUrl: './following-list.component.html'
11 })
12 export class FollowingListComponent extends RestTable {
13   following: AccountFollow[] = []
14   totalRecords = 0
15   rowsPerPage = 10
16   sort: SortMeta = { field: 'createdAt', order: 1 }
17   pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
18
19   constructor (
20     private notificationsService: NotificationsService,
21     private followService: FollowService
22   ) {
23     super()
24   }
25
26   protected loadData () {
27     this.followService.getFollowing(this.pagination, this.sort)
28                       .subscribe(
29                         resultList => {
30                           this.following = resultList.data
31                           this.totalRecords = resultList.total
32                         },
33
34                         err => this.notificationsService.error('Error', err.message)
35                       )
36   }
37 }