diff options
Diffstat (limited to 'client/src/app/+video-studio/shared/video-studio.service.ts')
-rw-r--r-- | client/src/app/+video-studio/shared/video-studio.service.ts | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/client/src/app/+video-studio/shared/video-studio.service.ts b/client/src/app/+video-studio/shared/video-studio.service.ts new file mode 100644 index 000000000..8d8b2f0e5 --- /dev/null +++ b/client/src/app/+video-studio/shared/video-studio.service.ts | |||
@@ -0,0 +1,28 @@ | |||
1 | import { catchError } from 'rxjs' | ||
2 | import { HttpClient } from '@angular/common/http' | ||
3 | import { Injectable } from '@angular/core' | ||
4 | import { RestExtractor } from '@app/core' | ||
5 | import { objectToFormData } from '@app/helpers' | ||
6 | import { VideoService } from '@app/shared/shared-main' | ||
7 | import { VideoStudioCreateEdition, VideoStudioTask } from '@shared/models' | ||
8 | |||
9 | @Injectable() | ||
10 | export class VideoStudioService { | ||
11 | |||
12 | constructor ( | ||
13 | private authHttp: HttpClient, | ||
14 | private restExtractor: RestExtractor | ||
15 | ) {} | ||
16 | |||
17 | editVideo (videoId: number | string, tasks: VideoStudioTask[]) { | ||
18 | const url = VideoService.BASE_VIDEO_URL + '/' + videoId + '/studio/edit' | ||
19 | const body: VideoStudioCreateEdition = { | ||
20 | tasks | ||
21 | } | ||
22 | |||
23 | const data = objectToFormData(body) | ||
24 | |||
25 | return this.authHttp.post(url, data) | ||
26 | .pipe(catchError(err => this.restExtractor.handleError(err))) | ||
27 | } | ||
28 | } | ||