diff options
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.ts | 33 |
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 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { FormBuilder, FormGroup } from '@angular/forms' | 2 | import { FormBuilder, FormGroup } from '@angular/forms' |
3 | import { ActivatedRoute, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { Observable } from 'rxjs/Observable' | ||
5 | import 'rxjs/add/observable/forkJoin' | ||
4 | 6 | ||
5 | import { NotificationsService } from 'angular2-notifications' | 7 | import { 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 () { |