2018-04-25 09:56:13 -05:00
|
|
|
import { Component, OnInit } from '@angular/core'
|
|
|
|
import { ActivatedRoute } from '@angular/router'
|
|
|
|
import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
|
|
|
|
import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
|
2018-05-31 04:35:01 -05:00
|
|
|
import { RestExtractor } from '@app/shared'
|
|
|
|
import { catchError } from 'rxjs/operators'
|
2018-04-25 09:56:13 -05:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
templateUrl: './video-channels.component.html',
|
|
|
|
styleUrls: [ './video-channels.component.scss' ]
|
|
|
|
})
|
|
|
|
export class VideoChannelsComponent implements OnInit {
|
|
|
|
videoChannel: VideoChannel
|
|
|
|
|
|
|
|
constructor (
|
|
|
|
private route: ActivatedRoute,
|
2018-05-31 04:35:01 -05:00
|
|
|
private videoChannelService: VideoChannelService,
|
|
|
|
private restExtractor: RestExtractor
|
2018-04-25 09:56:13 -05:00
|
|
|
) {}
|
|
|
|
|
|
|
|
ngOnInit () {
|
|
|
|
const videoChannelId = this.route.snapshot.params['videoChannelId']
|
|
|
|
|
|
|
|
this.videoChannelService.getVideoChannel(videoChannelId)
|
2018-05-31 04:35:01 -05:00
|
|
|
.pipe(catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ])))
|
2018-04-25 09:56:13 -05:00
|
|
|
.subscribe(videoChannel => this.videoChannel = videoChannel)
|
|
|
|
}
|
|
|
|
}
|