diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-07 11:19:26 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-07 11:19:26 +0200 |
commit | 734a5ceb3d04088743d72babcb9b05e6142043f6 (patch) | |
tree | 965bfbd0bf930cf4cc9568a5dc801c4e3909a1b4 /client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts | |
parent | cc69c8db39f48b1053c246458541ccc406228711 (diff) | |
download | PeerTube-734a5ceb3d04088743d72babcb9b05e6142043f6.tar.gz PeerTube-734a5ceb3d04088743d72babcb9b05e6142043f6.tar.zst PeerTube-734a5ceb3d04088743d72babcb9b05e6142043f6.zip |
Fix account/channel pages route subscription
Diffstat (limited to 'client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts')
-rw-r--r-- | client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts index c5fd442c6..dc0893962 100644 --- a/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts +++ b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts | |||
@@ -1,17 +1,20 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute } from '@angular/router' | 2 | import { ActivatedRoute } from '@angular/router' |
3 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' | 3 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' |
4 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | 4 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | 5 | import { I18n } from '@ngx-translate/i18n-polyfill' |
6 | import { Subscription } from 'rxjs' | ||
6 | 7 | ||
7 | @Component({ | 8 | @Component({ |
8 | selector: 'my-video-channel-about', | 9 | selector: 'my-video-channel-about', |
9 | templateUrl: './video-channel-about.component.html', | 10 | templateUrl: './video-channel-about.component.html', |
10 | styleUrls: [ './video-channel-about.component.scss' ] | 11 | styleUrls: [ './video-channel-about.component.scss' ] |
11 | }) | 12 | }) |
12 | export class VideoChannelAboutComponent implements OnInit { | 13 | export class VideoChannelAboutComponent implements OnInit, OnDestroy { |
13 | videoChannel: VideoChannel | 14 | videoChannel: VideoChannel |
14 | 15 | ||
16 | private videoChannelSub: Subscription | ||
17 | |||
15 | constructor ( | 18 | constructor ( |
16 | private route: ActivatedRoute, | 19 | private route: ActivatedRoute, |
17 | private i18n: I18n, | 20 | private i18n: I18n, |
@@ -20,10 +23,14 @@ export class VideoChannelAboutComponent implements OnInit { | |||
20 | 23 | ||
21 | ngOnInit () { | 24 | ngOnInit () { |
22 | // Parent get the video channel for us | 25 | // Parent get the video channel for us |
23 | this.videoChannelService.videoChannelLoaded | 26 | this.videoChannelSub = this.videoChannelService.videoChannelLoaded |
24 | .subscribe(videoChannel => this.videoChannel = videoChannel) | 27 | .subscribe(videoChannel => this.videoChannel = videoChannel) |
25 | } | 28 | } |
26 | 29 | ||
30 | ngOnDestroy () { | ||
31 | if (this.videoChannelSub) this.videoChannelSub.unsubscribe() | ||
32 | } | ||
33 | |||
27 | getVideoChannelDescription () { | 34 | getVideoChannelDescription () { |
28 | if (this.videoChannel.description) return this.videoChannel.description | 35 | if (this.videoChannel.description) return this.videoChannel.description |
29 | 36 | ||