diff options
Diffstat (limited to 'client/src/app/videos/+video-watch/comment')
-rw-r--r-- | client/src/app/videos/+video-watch/comment/video-comment.service.ts | 9 | ||||
-rw-r--r-- | client/src/app/videos/+video-watch/comment/video-comments.component.ts | 4 |
2 files changed, 6 insertions, 7 deletions
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.service.ts b/client/src/app/videos/+video-watch/comment/video-comment.service.ts index eb608a1a3..550d42fa8 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.service.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment.service.ts | |||
@@ -52,7 +52,7 @@ export class VideoCommentService { | |||
52 | videoId: number | string, | 52 | videoId: number | string, |
53 | componentPagination: ComponentPagination, | 53 | componentPagination: ComponentPagination, |
54 | sort: VideoSortField | 54 | sort: VideoSortField |
55 | }): Observable<{ comments: VideoComment[], totalComments: number}> { | 55 | }): Observable<ResultList<VideoComment>> { |
56 | const { videoId, componentPagination, sort } = parameters | 56 | const { videoId, componentPagination, sort } = parameters |
57 | 57 | ||
58 | const pagination = this.restService.componentPaginationToRestPagination(componentPagination) | 58 | const pagination = this.restService.componentPaginationToRestPagination(componentPagination) |
@@ -61,10 +61,9 @@ export class VideoCommentService { | |||
61 | params = this.restService.addRestGetParams(params, pagination, sort) | 61 | params = this.restService.addRestGetParams(params, pagination, sort) |
62 | 62 | ||
63 | const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comment-threads' | 63 | const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comment-threads' |
64 | return this.authHttp | 64 | return this.authHttp.get<ResultList<VideoComment>>(url, { params }) |
65 | .get(url, { params }) | ||
66 | .pipe( | 65 | .pipe( |
67 | map(this.extractVideoComments), | 66 | map(result => this.extractVideoComments(result)), |
68 | catchError(err => this.restExtractor.handleError(err)) | 67 | catchError(err => this.restExtractor.handleError(err)) |
69 | ) | 68 | ) |
70 | } | 69 | } |
@@ -136,7 +135,7 @@ export class VideoCommentService { | |||
136 | comments.push(new VideoComment(videoCommentJson)) | 135 | comments.push(new VideoComment(videoCommentJson)) |
137 | } | 136 | } |
138 | 137 | ||
139 | return { comments, totalComments } | 138 | return { data: comments, total: totalComments } |
140 | } | 139 | } |
141 | 140 | ||
142 | private extractVideoCommentTree (tree: VideoCommentThreadTree) { | 141 | private extractVideoCommentTree (tree: VideoCommentThreadTree) { |
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts index 3c1a0986c..5bafc55e5 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.ts | |||
@@ -122,8 +122,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
122 | 122 | ||
123 | obs.subscribe( | 123 | obs.subscribe( |
124 | res => { | 124 | res => { |
125 | this.comments = this.comments.concat(res.comments) | 125 | this.comments = this.comments.concat(res.data) |
126 | this.componentPagination.totalItems = res.totalComments | 126 | this.componentPagination.totalItems = res.total |
127 | }, | 127 | }, |
128 | 128 | ||
129 | err => this.notifier.error(err.message) | 129 | err => this.notifier.error(err.message) |