]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/+video-watch/comment/video-comment.service.ts
Use search client scope
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / +video-watch / comment / video-comment.service.ts
index eb608a1a36a9cec2ddfe57d03dee0642af3c23e7..550d42fa86552c65a2b100ff8691a6b4a26c2f14 100644 (file)
@@ -52,7 +52,7 @@ export class VideoCommentService {
     videoId: number | string,
     componentPagination: ComponentPagination,
     sort: VideoSortField
-  }): Observable<{ comments: VideoComment[], totalComments: number}> {
+  }): Observable<ResultList<VideoComment>> {
     const { videoId, componentPagination, sort } = parameters
 
     const pagination = this.restService.componentPaginationToRestPagination(componentPagination)
@@ -61,10 +61,9 @@ export class VideoCommentService {
     params = this.restService.addRestGetParams(params, pagination, sort)
 
     const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comment-threads'
-    return this.authHttp
-               .get(url, { params })
+    return this.authHttp.get<ResultList<VideoComment>>(url, { params })
                .pipe(
-                 map(this.extractVideoComments),
+                 map(result => this.extractVideoComments(result)),
                  catchError(err => this.restExtractor.handleError(err))
                )
   }
@@ -136,7 +135,7 @@ export class VideoCommentService {
       comments.push(new VideoComment(videoCommentJson))
     }
 
-    return { comments, totalComments }
+    return { data: comments, total: totalComments }
   }
 
   private extractVideoCommentTree (tree: VideoCommentThreadTree) {