Fix rating modal using old endpoint on mobile

This commit is contained in:
Amelia 2025-06-26 20:52:58 +02:00
parent cbbd2f301e
commit 296029adc2
3 changed files with 6 additions and 6 deletions

View file

@ -81,10 +81,6 @@ export class SeriesService {
return this.httpClient.post<string>(this.baseUrl + 'series/delete-multiple', {seriesIds}, TextResonse).pipe(map(s => s === "true"));
}
updateRating(seriesId: number, userRating: number) {
return this.httpClient.post(this.baseUrl + 'series/update-rating', {seriesId, userRating});
}
updateSeries(model: any) {
return this.httpClient.post(this.baseUrl + 'series/update', model);
}

View file

@ -78,6 +78,7 @@ export class ExternalRatingComponent implements OnInit {
modalRef.componentInstance.userRating = this.userRating;
modalRef.componentInstance.seriesId = this.seriesId;
modalRef.componentInstance.hasUserRated = this.hasUserRated;
modalRef.componentInstance.chapterId = this.chapterId;
modalRef.closed.subscribe((updated: {hasUserRated: boolean, userRating: number}) => {
this.userRating = updated.userRating;

View file

@ -5,6 +5,7 @@ import {Breakpoint} from "../../../shared/_services/utility.service";
import {NgxStarsModule} from "ngx-stars";
import {ThemeService} from "../../../_services/theme.service";
import {SeriesService} from "../../../_services/series.service";
import {ReviewService} from "../../../_services/review.service";
@Component({
selector: 'app-rating-modal',
@ -20,7 +21,7 @@ export class RatingModalComponent {
protected readonly modal = inject(NgbActiveModal);
protected readonly themeService = inject(ThemeService);
protected readonly seriesService = inject(SeriesService);
protected readonly reviewService = inject(ReviewService);
protected readonly cdRef = inject(ChangeDetectorRef);
protected readonly Breakpoint = Breakpoint;
@ -28,14 +29,16 @@ export class RatingModalComponent {
@Input({required: true}) userRating!: number;
@Input({required: true}) seriesId!: number;
@Input({required: true}) hasUserRated!: boolean;
@Input() chapterId: number | undefined;
starColor = this.themeService.getCssVariable('--rating-star-color');
updateRating(rating: number) {
this.seriesService.updateRating(this.seriesId, rating).subscribe(() => {
this.reviewService.updateRating(this.seriesId, rating, this.chapterId).subscribe(() => {
this.userRating = rating;
this.hasUserRated = true;
this.cdRef.markForCheck();
this.close();
});
}