remove unused toastService from edit dialogs and add confirmation

This commit is contained in:
Michael Shamoon
2022-11-08 10:53:41 -08:00
parent 4ffb08bf24
commit 36fb9b12e3
5 changed files with 35 additions and 29 deletions

View File

@@ -120,8 +120,20 @@ export abstract class ManagementListComponent<T extends ObjectWithId>
backdrop: 'static',
})
activeModal.componentInstance.dialogMode = 'create'
activeModal.componentInstance.success.subscribe((o) => {
this.reloadData()
activeModal.componentInstance.success.subscribe({
next: () => {
this.reloadData()
this.toastService.showInfo(
$localize`Successfully created ${this.typeName}.`
)
},
error: (e) => {
this.toastService.showInfo(
$localize`Error occurred while creating ${
this.typeName
} : ${e.toString()}.`
)
},
})
}
@@ -131,8 +143,20 @@ export abstract class ManagementListComponent<T extends ObjectWithId>
})
activeModal.componentInstance.object = object
activeModal.componentInstance.dialogMode = 'edit'
activeModal.componentInstance.success.subscribe((o) => {
this.reloadData()
activeModal.componentInstance.success.subscribe({
next: () => {
this.reloadData()
this.toastService.showInfo(
$localize`Successfully updated ${this.typeName}.`
)
},
error: (e) => {
this.toastService.showInfo(
$localize`Error occurred while saving ${
this.typeName
} : ${e.toString()}.`
)
},
})
}