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 { 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 title: string
date: Date date: Date
seasons: number seasons: number

View file

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