]>
Commit | Line | Data |
---|---|---|
51548b31 C |
1 | import { Component, OnInit } from '@angular/core' |
2 | ||
3 | import { NotificationsService } from 'angular2-notifications' | |
4 | import { SortMeta } from 'primeng/primeng' | |
5 | ||
6 | import { ConfirmService } from '../../../core' | |
7 | import { RestTable, RestPagination } from '../../../shared' | |
8 | import { Pod } from '../../../../../../shared' | |
9 | import { FollowService } from '../shared' | |
10 | ||
11 | @Component({ | |
12 | selector: 'my-followers-list', | |
13 | templateUrl: './following-list.component.html' | |
14 | }) | |
15 | export class FollowingListComponent extends RestTable { | |
16 | following: Pod[] = [] | |
17 | totalRecords = 0 | |
18 | rowsPerPage = 10 | |
19 | sort: SortMeta = { field: 'createdAt', order: 1 } | |
20 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | |
21 | ||
22 | constructor ( | |
23 | private notificationsService: NotificationsService, | |
24 | private followService: FollowService | |
25 | ) { | |
26 | super() | |
27 | } | |
28 | ||
29 | protected loadData () { | |
30 | this.followService.getFollowing(this.pagination, this.sort) | |
31 | .subscribe( | |
32 | resultList => { | |
33 | this.following = resultList.data | |
34 | this.totalRecords = resultList.total | |
35 | }, | |
36 | ||
37 | err => this.notificationsService.error('Error', err.message) | |
38 | ) | |
39 | } | |
40 | } |