Interfaces/show: make id optional

This commit is contained in:
Toast 2025-02-05 02:20:40 +01:00
parent ee6ebfd98c
commit 92360fdad9
2 changed files with 14 additions and 11 deletions

View file

@ -1,5 +1,6 @@
export interface Show {
_id: string
// ID is assigned by the DB, so I don't want to have to specify it
_id?: string
title: string
date: Date
seasons: number

View file

@ -72,17 +72,19 @@ export class ShowsComponent {
modal.result.then(
(result) => {
if (result) {
this.api.deleteShw(show._id).subscribe({
next: (response: ShowsApiDeletion) => {
// Do nothing
}, error: (err: any) => {
console.log(err)
}, complete: () => {
this.toastService.show({body: "Show deleted!"})
this.shows = this.shows.filter(((s: Show) => s != show))
if (show._id != null) {
this.api.deleteShw(show._id).subscribe({
next: (response: ShowsApiDeletion) => {
// Do nothing
}, error: (err: any) => {
console.log(err)
}, complete: () => {
this.toastService.show({body: "Show deleted!"})
this.shows = this.shows.filter(((s: Show) => s != show))
}
}
}
)
)
}
}
},
(result) => {