]>
Commit | Line | Data |
---|---|---|
60862425 | 1 | import { Component } from '@angular/core' |
51548b31 C |
2 | import { NotificationsService } from 'angular2-notifications' |
3 | import { SortMeta } from 'primeng/primeng' | |
60862425 C |
4 | import { AccountFollow } from '../../../../../../shared/models/accounts/follow.model' |
5 | import { RestPagination, RestTable } from '../../../shared' | |
51548b31 C |
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 { | |
60862425 | 13 | following: AccountFollow[] = [] |
51548b31 C |
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 | } |