diff options
Diffstat (limited to 'client/src/app/videos/shared/video.service.ts')
-rw-r--r-- | client/src/app/videos/shared/video.service.ts | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/client/src/app/videos/shared/video.service.ts b/client/src/app/videos/shared/video.service.ts index 13d4ca246..ee67bc1ae 100644 --- a/client/src/app/videos/shared/video.service.ts +++ b/client/src/app/videos/shared/video.service.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Injectable } from '@angular/core'; | 1 | import { Injectable } from '@angular/core'; |
2 | import { Http } from '@angular/http'; | 2 | import { Http, Headers, RequestOptions } from '@angular/http'; |
3 | import { Observable } from 'rxjs/Observable'; | 3 | import { Observable } from 'rxjs/Observable'; |
4 | import 'rxjs/add/operator/catch'; | 4 | import 'rxjs/add/operator/catch'; |
5 | import 'rxjs/add/operator/map'; | 5 | import 'rxjs/add/operator/map'; |
@@ -80,6 +80,23 @@ export class VideoService { | |||
80 | .catch((res) => this.restExtractor.handleError(res)); | 80 | .catch((res) => this.restExtractor.handleError(res)); |
81 | } | 81 | } |
82 | 82 | ||
83 | updateVideo(video: Video) { | ||
84 | const body = { | ||
85 | name: video.name, | ||
86 | category: video.category, | ||
87 | licence: video.licence, | ||
88 | language: video.language, | ||
89 | description: video.description, | ||
90 | tags: video.tags | ||
91 | }; | ||
92 | const headers = new Headers({ 'Content-Type': 'application/json' }); | ||
93 | const options = new RequestOptions({ headers: headers }); | ||
94 | |||
95 | return this.authHttp.put(`${VideoService.BASE_VIDEO_URL}/${video.id}`, body, options) | ||
96 | .map(this.restExtractor.extractDataBool) | ||
97 | .catch(this.restExtractor.handleError); | ||
98 | } | ||
99 | |||
83 | getVideos(pagination: RestPagination, sort: SortField) { | 100 | getVideos(pagination: RestPagination, sort: SortField) { |
84 | const params = this.restService.buildRestGetParams(pagination, sort); | 101 | const params = this.restService.buildRestGetParams(pagination, sort); |
85 | 102 | ||