F: Fixed movie entry not showing up correctly in library page when adding a seen date to it while it is in watchlist.
This commit is contained in:
1 parent
0466082fe8
commit
b799e1cada
4 files changed
+76
-52
No files matched your search
@@ -79,25 +79,24 @@ export class LibraryService implements OnInit {
|
||||
const existingEntry = this.entriesSubject
|
||||
.getValue()
|
||||
.find((entry) => entry.entryId?.tmdb_id == tmdb_id);
|
||||
if (existingEntry) {
|
||||
return of(existingEntry);
|
||||
} else {
|
||||
return this.http
|
||||
.post<Entry>(`${this.backend_apiUrl}/${this.apiAction}`, {
|
||||
tmdb_id: tmdb_id,
|
||||
is_tvserie: is_tvserie,
|
||||
|
||||
if (existingEntry) return of(existingEntry);
|
||||
|
||||
return this.http
|
||||
.post<Entry>(`${this.backend_apiUrl}/${this.apiAction}`, {
|
||||
tmdb_id: tmdb_id,
|
||||
is_tvserie: is_tvserie,
|
||||
})
|
||||
.pipe(
|
||||
tap((newEntry) => {
|
||||
newEntry.isInLibrary = true;
|
||||
|
||||
const currentEntries = this.entriesSubject.getValue();
|
||||
const updatedEntries = [...currentEntries, newEntry];
|
||||
|
||||
this.entriesSubject.next(updatedEntries);
|
||||
})
|
||||
.pipe(
|
||||
tap((newEntry) => {
|
||||
newEntry.isInLibrary = true;
|
||||
|
||||
const currentEntries = this.entriesSubject.getValue();
|
||||
const updatedEntries = [...currentEntries, newEntry];
|
||||
|
||||
this.entriesSubject.next(updatedEntries);
|
||||
}) // Add new entry to the list
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public deleteEntry(id: number): Observable<any> {
|
||||
@@ -115,11 +114,13 @@ export class LibraryService implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
public setEntry(entry: Entry) {
|
||||
public updateEntry(entry: Entry) {
|
||||
const currentEntries = this.entriesSubject.getValue();
|
||||
let updatedEntries = currentEntries.filter((e) => e.id != entry.id);
|
||||
|
||||
updatedEntries.push(entry);
|
||||
const updatedEntries = [
|
||||
...currentEntries.filter((e) => e.id !== entry.id),
|
||||
entry,
|
||||
];
|
||||
|
||||
this.entriesSubject.next(updatedEntries);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user