addEntry bug fix (entry doesn't have id)
This commit is contained in:
1 parent
e639fb1036
commit
863f6bbf11
1 file changed
+4
-3
@@ -127,9 +127,9 @@ export class LibraryService implements OnInit {
|
|||||||
addEntry(tmdb_id: string, is_tvserie: boolean): Observable<Entry | null> {
|
addEntry(tmdb_id: string, is_tvserie: boolean): Observable<Entry | null> {
|
||||||
return this.getAllEntries().pipe(
|
return this.getAllEntries().pipe(
|
||||||
switchMap((entries) => {
|
switchMap((entries) => {
|
||||||
const existingEntry = entries.find(
|
const existingEntry = entries.find((entry) => {
|
||||||
(entry) => entry.entryId.imdb_id === tmdb_id
|
if (entry.entryId?.tmdb_id) entry.entryId.tmdb_id == tmdb_id;
|
||||||
);
|
});
|
||||||
if (existingEntry) {
|
if (existingEntry) {
|
||||||
return of(existingEntry);
|
return of(existingEntry);
|
||||||
} else {
|
} else {
|
||||||
@@ -150,6 +150,7 @@ export class LibraryService implements OnInit {
|
|||||||
isInLibrary(tmdb_id: string): Observable<Entry | null> {
|
isInLibrary(tmdb_id: string): Observable<Entry | null> {
|
||||||
return this.getAllEntries().pipe(
|
return this.getAllEntries().pipe(
|
||||||
switchMap((entries) => {
|
switchMap((entries) => {
|
||||||
|
if (entries.length == 0) return of(null);
|
||||||
const existingEntry = entries.find((entry) => {
|
const existingEntry = entries.find((entry) => {
|
||||||
// console.log(entry.entryId.tmdb_id, tmdb_id);
|
// console.log(entry.entryId.tmdb_id, tmdb_id);
|
||||||
return entry.entryId.tmdb_id == tmdb_id;
|
return entry.entryId.tmdb_id == tmdb_id;
|
||||||
|
|||||||
Reference in new issue
Block a user