]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/video-caption/video-caption.service.ts
Correctly handle error when remote instance is down
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / video-caption / video-caption.service.ts
index 4ae8ebd0a5c89b9e51feba24997715ca65d8eafd..d1444902d1dd6e5dfe1a3c0d4149fbb62f38212b 100644 (file)
@@ -1,7 +1,7 @@
 import { catchError, map } from 'rxjs/operators'
 import { HttpClient } from '@angular/common/http'
 import { Injectable } from '@angular/core'
-import { forkJoin, Observable } from 'rxjs'
+import { forkJoin, Observable, of } from 'rxjs'
 import { ResultList } from '../../../../../shared'
 import { RestExtractor, RestService } from '../rest'
 import { VideoCaption } from '../../../../../shared/models/videos/video-caption.model'
@@ -42,6 +42,8 @@ export class VideoCaptionService {
   }
 
   updateCaptions (videoId: number | string, videoCaptions: VideoCaptionEdit[]) {
+    if (videoCaptions.length === 0) return of(true)
+
     const observables: Observable<any>[] = []
 
     for (const videoCaption of videoCaptions) {