Interfaces/show: make id optional
This commit is contained in:
parent
ee6ebfd98c
commit
92360fdad9
2 changed files with 14 additions and 11 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue