aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-edit/video-update.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/videos/+video-edit/video-update.component.ts')
-rw-r--r--client/src/app/videos/+video-edit/video-update.component.ts33
1 files changed, 21 insertions, 12 deletions
diff --git a/client/src/app/videos/+video-edit/video-update.component.ts b/client/src/app/videos/+video-edit/video-update.component.ts
index 30390ac05..6ced77f1a 100644
--- a/client/src/app/videos/+video-edit/video-update.component.ts
+++ b/client/src/app/videos/+video-edit/video-update.component.ts
@@ -1,6 +1,8 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { FormBuilder, FormGroup } from '@angular/forms' 2import { FormBuilder, FormGroup } from '@angular/forms'
3import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
4import { Observable } from 'rxjs/Observable'
5import 'rxjs/add/observable/forkJoin'
4 6
5import { NotificationsService } from 'angular2-notifications' 7import { NotificationsService } from 'angular2-notifications'
6 8
@@ -84,19 +86,26 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
84 this.videoLanguages = this.serverService.getVideoLanguages() 86 this.videoLanguages = this.serverService.getVideoLanguages()
85 87
86 const uuid: string = this.route.snapshot.params['uuid'] 88 const uuid: string = this.route.snapshot.params['uuid']
87 this.videoService.getVideo(uuid)
88 .subscribe(
89 video => {
90 this.video = new VideoEdit(video)
91
92 this.hydrateFormFromVideo()
93 },
94 89
95 err => { 90 this.videoService.getVideo(uuid)
96 console.error(err) 91 .switchMap(video => {
97 this.error = 'Cannot fetch video.' 92 return this.videoService
98 } 93 .loadCompleteDescription(video.descriptionPath)
99 ) 94 .do(description => video.description = description)
95 .map(() => video)
96 })
97 .subscribe(
98 video => {
99 this.video = new VideoEdit(video)
100
101 this.hydrateFormFromVideo()
102 },
103
104 err => {
105 console.error(err)
106 this.error = 'Cannot fetch video.'
107 }
108 )
100 } 109 }
101 110
102 checkForm () { 111 checkForm () {