// Unlogged users do not have ratings
if (this.isUserLoggedIn === false) return
- this.videoService.getUserVideoRating(this.video.id)
- .subscribe(
- ratingObject => {
+ this.videoService.getUserVideoRating(this.video.uuid)
+ .subscribe({
+ next: ratingObject => {
if (!ratingObject) return
this.userRating = ratingObject.rating
this.userRatingLoaded.emit(this.userRating)
},
- err => this.notifier.error(err.message)
- )
+ error: err => this.notifier.error(err.message)
+ })
}
private setRating (nextRating: UserVideoRateType) {
- const ratingMethods: { [id in UserVideoRateType]: (id: number) => Observable<any> } = {
+ const ratingMethods: { [id in UserVideoRateType]: (id: string) => Observable<any> } = {
like: this.videoService.setVideoLike,
dislike: this.videoService.setVideoDislike,
none: this.videoService.unsetVideoLike
}
- ratingMethods[nextRating].call(this.videoService, this.video.id)
- .subscribe(
- () => {
+ ratingMethods[nextRating].call(this.videoService, this.video.uuid)
+ .subscribe({
+ next: () => {
// Update the video like attribute
this.updateVideoRating(this.userRating, nextRating)
this.userRating = nextRating
this.rateUpdated.emit(this.userRating)
},
- (err: { message: string }) => this.notifier.error(err.message)
- )
+ error: err => this.notifier.error(err.message)
+ })
}
private updateVideoRating (oldRating: UserVideoRateType, newRating: UserVideoRateType) {