]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+admin/follows/followers-list/followers-list.component.ts
Refractor notification service
[github/Chocobozzz/PeerTube.git] / client / src / app / +admin / follows / followers-list / followers-list.component.ts
index 64981570902b0450ce8db3c123eb961b92fbcc59..9a8848bfb2eb48aff92f445d5f6d34d84e6b61ca 100644 (file)
@@ -1,39 +1,45 @@
-import { Component } from '@angular/core'
+import { Component, OnInit } from '@angular/core'
 
-import { NotificationsService } from 'angular2-notifications'
+import { Notifier } from '@app/core'
 import { SortMeta } from 'primeng/primeng'
-import { AccountFollow } from '../../../../../../shared/models/actors/follow.model'
+import { ActorFollow } from '../../../../../../shared/models/actors/follow.model'
 import { RestPagination, RestTable } from '../../../shared'
 import { FollowService } from '../shared'
+import { I18n } from '@ngx-translate/i18n-polyfill'
 
 @Component({
   selector: 'my-followers-list',
   templateUrl: './followers-list.component.html',
   styleUrls: [ './followers-list.component.scss' ]
 })
-export class FollowersListComponent extends RestTable {
-  followers: AccountFollow[] = []
+export class FollowersListComponent extends RestTable implements OnInit {
+  followers: ActorFollow[] = []
   totalRecords = 0
   rowsPerPage = 10
   sort: SortMeta = { field: 'createdAt', order: 1 }
   pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
 
   constructor (
-    private notificationsService: NotificationsService,
-    private followService: FollowService
+    private notifier: Notifier,
+    private followService: FollowService,
+    private i18n: I18n
   ) {
     super()
   }
 
+  ngOnInit () {
+    this.initialize()
+  }
+
   protected loadData () {
-    this.followService.getFollowers(this.pagination, this.sort)
+    this.followService.getFollowers(this.pagination, this.sort, this.search)
                       .subscribe(
                         resultList => {
                           this.followers = resultList.data
                           this.totalRecords = resultList.total
                         },
 
-                        err => this.notificationsService.error('Error', err.message)
+                        err => this.notifier.error(err.message)
                       )
   }
 }