Skip to content

Commit

Permalink
fix(discover): 🐛 Fixed the default poster not taking into account the…
Browse files Browse the repository at this point in the history
… base url in some scenarios #4845
  • Loading branch information
tidusjar committed Jan 22, 2023
1 parent 854d1c0 commit 8eda250
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Component, OnInit, Input, ViewChild, Output, EventEmitter } from "@angular/core";
import { Component, OnInit, Input, ViewChild, Output, EventEmitter, Inject } from "@angular/core";
import { DiscoverOption, IDiscoverCardResult } from "../../interfaces";
import { ISearchMovieResult, ISearchTvResult, RequestType } from "../../../interfaces";
import { SearchV2Service } from "../../../services";
import { StorageService } from "../../../shared/storage/storage-service";
import { MatButtonToggleChange } from '@angular/material/button-toggle';
import { Carousel } from 'primeng/carousel';
import { FeaturesFacade } from "../../../state/features/features.facade";
import { APP_BASE_HREF } from "@angular/common";

export enum DiscoverType {
Upcoming,
Expand Down Expand Up @@ -44,10 +45,18 @@ export class CarouselListComponent implements OnInit {
};
private amountToLoad = 17;
private currentlyLoaded = 0;
private baseUrl: string;


constructor(private searchService: SearchV2Service,
private storageService: StorageService,
private featureFacade: FeaturesFacade) {
private featureFacade: FeaturesFacade,
@Inject(APP_BASE_HREF) private href: string) {

if (this.href.length > 1) {
this.baseUrl = this.href;
}

Carousel.prototype.onTouchMove = () => { },
this.responsiveOptions = [
{
Expand Down Expand Up @@ -294,7 +303,7 @@ export class CarouselListComponent implements OnInit {
this.movies.forEach(m => {
tempResults.push({
available: m.available,
posterPath: m.posterPath ? `https://image.tmdb.org/t/p/w500/${m.posterPath}` : "../../../images/default_movie_poster.png",
posterPath: m.posterPath ? `https://image.tmdb.org/t/p/w500/${m.posterPath}` : this.baseUrl + "/images/default_movie_poster.png",
requested: m.requested,
title: m.title,
type: RequestType.movie,
Expand All @@ -316,7 +325,7 @@ export class CarouselListComponent implements OnInit {
this.tvShows.forEach(m => {
tempResults.push({
available: m.fullyAvailable,
posterPath: m.backdropPath ? `https://image.tmdb.org/t/p/w500/${m.backdropPath}` : "../../../images/default_tv_poster.png",
posterPath: m.backdropPath ? `https://image.tmdb.org/t/p/w500/${m.backdropPath}` : this.baseUrl + "/images/default_tv_poster.png",
requested: m.requested,
title: m.title,
type: RequestType.tvShow,
Expand Down

0 comments on commit 8eda250

Please sign in to comment.