add favorit button in entry page

This commit is contained in:
X4Lo committed 2024-04-28 00:26:07 +01:00
1 parent 62056bdc98
commit 299f566b96
6 files changed
+130 -45

No files matched your search

@@ -112,7 +112,7 @@ export class EntryPageComponent implements OnInit {
if (!this.entry) return;
const dialogRef = this.dialog.open(SeenModalComponent, {
width: '400px',
width: '360px',
});
console.log('Seen dialog opened');
@@ -183,6 +183,20 @@ export class EntryPageComponent implements OnInit {
});
}
toggleFavorite() {
this.entry.favorit = !this.entry.favorit;
this.entryService.updateEntry(this.entry).subscribe({
next: (entry) => {
console.log(`Entry updated: `, entry);
this.entry = entry;
},
error: (error) => {
console.log(`Error updating entry: `, error);
this.entry.favorit = !this.entry.favorit;
},
});
}
showAddToListModal() {
if (this.entry) {
const dialogRef = this.dialog.open(UserCollectionsModalComponent, {
@@ -278,7 +292,7 @@ export class EntryPageComponent implements OnInit {
if (episodeSeen == null) return;
const dialogRef = this.dialog.open(SeenModalComponent, {
width: '400px',
width: '360px',
data: {
watchDate: episodeSeen.date_seen,
watchedWith: episodeSeen.seen_with,