Fix rating modal using old endpoint on mobile
This commit is contained in:
parent
cbbd2f301e
commit
296029adc2
3 changed files with 6 additions and 6 deletions
|
|
@ -81,10 +81,6 @@ export class SeriesService {
|
||||||
return this.httpClient.post<string>(this.baseUrl + 'series/delete-multiple', {seriesIds}, TextResonse).pipe(map(s => s === "true"));
|
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) {
|
updateSeries(model: any) {
|
||||||
return this.httpClient.post(this.baseUrl + 'series/update', model);
|
return this.httpClient.post(this.baseUrl + 'series/update', model);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ export class ExternalRatingComponent implements OnInit {
|
||||||
modalRef.componentInstance.userRating = this.userRating;
|
modalRef.componentInstance.userRating = this.userRating;
|
||||||
modalRef.componentInstance.seriesId = this.seriesId;
|
modalRef.componentInstance.seriesId = this.seriesId;
|
||||||
modalRef.componentInstance.hasUserRated = this.hasUserRated;
|
modalRef.componentInstance.hasUserRated = this.hasUserRated;
|
||||||
|
modalRef.componentInstance.chapterId = this.chapterId;
|
||||||
|
|
||||||
modalRef.closed.subscribe((updated: {hasUserRated: boolean, userRating: number}) => {
|
modalRef.closed.subscribe((updated: {hasUserRated: boolean, userRating: number}) => {
|
||||||
this.userRating = updated.userRating;
|
this.userRating = updated.userRating;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import {Breakpoint} from "../../../shared/_services/utility.service";
|
||||||
import {NgxStarsModule} from "ngx-stars";
|
import {NgxStarsModule} from "ngx-stars";
|
||||||
import {ThemeService} from "../../../_services/theme.service";
|
import {ThemeService} from "../../../_services/theme.service";
|
||||||
import {SeriesService} from "../../../_services/series.service";
|
import {SeriesService} from "../../../_services/series.service";
|
||||||
|
import {ReviewService} from "../../../_services/review.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-rating-modal',
|
selector: 'app-rating-modal',
|
||||||
|
|
@ -20,7 +21,7 @@ export class RatingModalComponent {
|
||||||
|
|
||||||
protected readonly modal = inject(NgbActiveModal);
|
protected readonly modal = inject(NgbActiveModal);
|
||||||
protected readonly themeService = inject(ThemeService);
|
protected readonly themeService = inject(ThemeService);
|
||||||
protected readonly seriesService = inject(SeriesService);
|
protected readonly reviewService = inject(ReviewService);
|
||||||
protected readonly cdRef = inject(ChangeDetectorRef);
|
protected readonly cdRef = inject(ChangeDetectorRef);
|
||||||
|
|
||||||
protected readonly Breakpoint = Breakpoint;
|
protected readonly Breakpoint = Breakpoint;
|
||||||
|
|
@ -28,14 +29,16 @@ export class RatingModalComponent {
|
||||||
@Input({required: true}) userRating!: number;
|
@Input({required: true}) userRating!: number;
|
||||||
@Input({required: true}) seriesId!: number;
|
@Input({required: true}) seriesId!: number;
|
||||||
@Input({required: true}) hasUserRated!: boolean;
|
@Input({required: true}) hasUserRated!: boolean;
|
||||||
|
@Input() chapterId: number | undefined;
|
||||||
starColor = this.themeService.getCssVariable('--rating-star-color');
|
starColor = this.themeService.getCssVariable('--rating-star-color');
|
||||||
|
|
||||||
|
|
||||||
updateRating(rating: number) {
|
updateRating(rating: number) {
|
||||||
this.seriesService.updateRating(this.seriesId, rating).subscribe(() => {
|
this.reviewService.updateRating(this.seriesId, rating, this.chapterId).subscribe(() => {
|
||||||
this.userRating = rating;
|
this.userRating = rating;
|
||||||
this.hasUserRated = true;
|
this.hasUserRated = true;
|
||||||
this.cdRef.markForCheck();
|
this.cdRef.markForCheck();
|
||||||
|
this.close();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue