]>
Commit | Line | Data |
---|---|---|
170726f5 C |
1 | import { Component, OnInit } from '@angular/core' |
2 | import { ActivatedRoute } from '@angular/router' | |
3 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | |
4 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' | |
a51bad1a C |
5 | import { RestExtractor } from '@app/shared' |
6 | import { catchError } from 'rxjs/operators' | |
170726f5 C |
7 | |
8 | @Component({ | |
9 | templateUrl: './video-channels.component.html', | |
10 | styleUrls: [ './video-channels.component.scss' ] | |
11 | }) | |
12 | export class VideoChannelsComponent implements OnInit { | |
13 | videoChannel: VideoChannel | |
14 | ||
15 | constructor ( | |
16 | private route: ActivatedRoute, | |
a51bad1a C |
17 | private videoChannelService: VideoChannelService, |
18 | private restExtractor: RestExtractor | |
170726f5 C |
19 | ) {} |
20 | ||
21 | ngOnInit () { | |
22 | const videoChannelId = this.route.snapshot.params['videoChannelId'] | |
23 | ||
24 | this.videoChannelService.getVideoChannel(videoChannelId) | |
a51bad1a | 25 | .pipe(catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ]))) |
170726f5 C |
26 | .subscribe(videoChannel => this.videoChannel = videoChannel) |
27 | } | |
28 | } |