Front: minor change in tmdb service
This commit is contained in:
1 parent
532d9424a2
commit
2b2cc44851
1 file changed
+13
-1
@@ -5,6 +5,7 @@ import { Entry } from '../../shared/models/entry.model';
|
||||
import { EntryId } from '../../shared/models/entryId.model';
|
||||
import { EntryRating } from '../../shared/models/entryRating.model';
|
||||
import { environment } from '../../../environments/environment.prod';
|
||||
import { LibraryService } from './library.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -12,7 +13,10 @@ import { environment } from '../../../environments/environment.prod';
|
||||
export class TmdbService {
|
||||
cach: Record<string, Entry[]> = {};
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private libraryService: LibraryService
|
||||
) {}
|
||||
|
||||
// private apiUrl = environment.apiBaseUrl;
|
||||
private tmdb_apiUrl = environment.TMDB_API_URL;
|
||||
@@ -101,6 +105,14 @@ export class TmdbService {
|
||||
entry.media_type === 'tv' || entry.media_type === 'movie'
|
||||
),
|
||||
map((entry: any) => this.adaptMovieToEntry(entry)),
|
||||
switchMap((entry: any) =>
|
||||
this.libraryService.isInLibrary(entry.entryId.tmdb_id).pipe(
|
||||
map((inLibrary) => {
|
||||
// console.log(inLibrary);
|
||||
return inLibrary ? inLibrary : entry;
|
||||
})
|
||||
)
|
||||
),
|
||||
toArray(),
|
||||
map((entries) => ({
|
||||
entries: entries,
|
||||
|
||||
Reference in new issue
Block a user