diff options
Diffstat (limited to 'client/src/app/+video-editor/shared')
-rw-r--r-- | client/src/app/+video-editor/shared/index.ts | 1 | ||||
-rw-r--r-- | client/src/app/+video-editor/shared/video-editor.service.ts | 28 |
2 files changed, 29 insertions, 0 deletions
diff --git a/client/src/app/+video-editor/shared/index.ts b/client/src/app/+video-editor/shared/index.ts new file mode 100644 index 000000000..eaf88b6f4 --- /dev/null +++ b/client/src/app/+video-editor/shared/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './video-editor.service' | |||
diff --git a/client/src/app/+video-editor/shared/video-editor.service.ts b/client/src/app/+video-editor/shared/video-editor.service.ts new file mode 100644 index 000000000..5b7053039 --- /dev/null +++ b/client/src/app/+video-editor/shared/video-editor.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 { VideoEditorCreateEdition, VideoEditorTask } from '@shared/models' | ||
8 | |||
9 | @Injectable() | ||
10 | export class VideoEditorService { | ||
11 | |||
12 | constructor ( | ||
13 | private authHttp: HttpClient, | ||
14 | private restExtractor: RestExtractor | ||
15 | ) {} | ||
16 | |||
17 | editVideo (videoId: number | string, tasks: VideoEditorTask[]) { | ||
18 | const url = VideoService.BASE_VIDEO_URL + '/' + videoId + '/editor/edit' | ||
19 | const body: VideoEditorCreateEdition = { | ||
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 | } | ||