]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts
Refractor notification service
[github/Chocobozzz/PeerTube.git] / client / src / app / +video-channels / video-channel-videos / video-channel-videos.component.ts
index 28c591039fa59ef37dd4c76fed690fb9cc6780b0..70c4374e01d132cc39ddfea237b9bbf1ebdcbc4f 100644 (file)
@@ -2,7 +2,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
 import { Location } from '@angular/common'
 import { immutableAssign } from '@app/shared/misc/utils'
-import { NotificationsService } from 'angular2-notifications'
 import { AuthService } from '../../core/auth'
 import { ConfirmService } from '../../core/confirm'
 import { AbstractVideoList } from '../../shared/video/abstract-video-list'
@@ -11,6 +10,9 @@ import { VideoChannelService } from '@app/shared/video-channel/video-channel.ser
 import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
 import { tap } from 'rxjs/operators'
 import { I18n } from '@ngx-translate/i18n-polyfill'
+import { Subscription } from 'rxjs'
+import { ScreenService } from '@app/shared/misc/screen.service'
+import { Notifier } from '@app/core'
 
 @Component({
   selector: 'my-video-channel-videos',
@@ -23,18 +25,20 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
 export class VideoChannelVideosComponent extends AbstractVideoList implements OnInit, OnDestroy {
   titlePage: string
   marginContent = false // Disable margin
-  currentRoute = '/video-channel/videos'
+  currentRoute = '/video-channels/videos'
   loadOnInit = false
 
   private videoChannel: VideoChannel
+  private videoChannelSub: Subscription
 
   constructor (
     protected router: Router,
     protected route: ActivatedRoute,
     protected authService: AuthService,
-    protected notificationsService: NotificationsService,
+    protected notifier: Notifier,
     protected confirmService: ConfirmService,
     protected location: Location,
+    protected screenService: ScreenService,
     protected i18n: I18n,
     private videoChannelService: VideoChannelService,
     private videoService: VideoService
@@ -48,17 +52,19 @@ export class VideoChannelVideosComponent extends AbstractVideoList implements On
     super.ngOnInit()
 
     // Parent get the video channel for us
-    this.videoChannelService.videoChannelLoaded
+    this.videoChannelSub = this.videoChannelService.videoChannelLoaded
       .subscribe(videoChannel => {
         this.videoChannel = videoChannel
-        this.currentRoute = '/video-channel/' + this.videoChannel.uuid + '/videos'
+        this.currentRoute = '/video-channels/' + this.videoChannel.uuid + '/videos'
 
-        this.loadMoreVideos(this.pagination.currentPage)
+        this.reloadVideos()
         this.generateSyndicationList()
       })
   }
 
   ngOnDestroy () {
+    if (this.videoChannelSub) this.videoChannelSub.unsubscribe()
+
     super.ngOnDestroy()
   }