]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-main/video-caption/video-caption.service.ts
Remove unnecessary function
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / video-caption / video-caption.service.ts
index 283c63f9800b05bef686db0379644d3c286dd0dc..97b79d84268c0489bbdb25650a44fef9a49f2114 100644 (file)
@@ -18,7 +18,7 @@ export class VideoCaptionService {
   ) {}
 
   listCaptions (videoId: number | string): Observable<ResultList<VideoCaption>> {
-    return this.authHttp.get<ResultList<VideoCaption>>(VideoService.BASE_VIDEO_URL + videoId + '/captions')
+    return this.authHttp.get<ResultList<VideoCaption>>(`${VideoService.BASE_VIDEO_URL}/${videoId}/captions`)
                .pipe(
                  switchMap(captionsResult => {
                    return this.serverService.getServerLocale()
@@ -41,26 +41,20 @@ export class VideoCaptionService {
   }
 
   removeCaption (videoId: number | string, language: string) {
-    return this.authHttp.delete(VideoService.BASE_VIDEO_URL + videoId + '/captions/' + language)
-               .pipe(
-                 map(this.restExtractor.extractDataBool),
-                 catchError(res => this.restExtractor.handleError(res))
-               )
+    return this.authHttp.delete(`${VideoService.BASE_VIDEO_URL}/${videoId}/captions/${language}`)
+               .pipe(catchError(res => this.restExtractor.handleError(res)))
   }
 
   addCaption (videoId: number | string, language: string, captionfile: File) {
     const body = { captionfile }
     const data = objectToFormData(body)
 
-    return this.authHttp.put(VideoService.BASE_VIDEO_URL + videoId + '/captions/' + language, data)
-               .pipe(
-                 map(this.restExtractor.extractDataBool),
-                 catchError(res => this.restExtractor.handleError(res))
-               )
+    return this.authHttp.put(`${VideoService.BASE_VIDEO_URL}/${videoId}/captions/${language}`, data)
+               .pipe(catchError(res => this.restExtractor.handleError(res)))
   }
 
   updateCaptions (videoId: number | string, videoCaptions: VideoCaptionEdit[]) {
-    let obs = of(true)
+    let obs: Observable<any> = of(undefined)
 
     for (const videoCaption of videoCaptions) {
       if (videoCaption.action === 'CREATE') {