re-enable submit button in finally block
This commit is contained in:
@ -35,18 +35,23 @@ export class OverheadAdvanceDetailsComponent implements OnInit {
|
||||
}
|
||||
|
||||
async saveOverheadAdvance() {
|
||||
this.submitButton.disabled = true
|
||||
this.messageService.add("saveOverheadAdvance")
|
||||
this.messageService.add(JSON.stringify(this.overheadAdvance, undefined, 4))
|
||||
if (this.overheadAdvance.id == 0) {
|
||||
this.messageService.add("about to insert new overheadAdvance")
|
||||
this.overheadAdvance = await this.overheadAdvanceService.postOverheadAdvance(this.overheadAdvance)
|
||||
this.messageService.add(`Successfully added overheadAdvance with id ${this.overheadAdvance.id}`)
|
||||
} else {
|
||||
this.messageService.add("about to update existing overheadAdvance")
|
||||
try {
|
||||
this.submitButton.disabled = true
|
||||
this.messageService.add("saveOverheadAdvance")
|
||||
this.messageService.add(JSON.stringify(this.overheadAdvance, undefined, 4))
|
||||
if (this.overheadAdvance.id == 0) {
|
||||
this.messageService.add("about to insert new overheadAdvance")
|
||||
this.overheadAdvance = await this.overheadAdvanceService.postOverheadAdvance(this.overheadAdvance)
|
||||
this.messageService.add(`Successfully added overheadAdvance with id ${this.overheadAdvance.id}`)
|
||||
} else {
|
||||
this.messageService.add("about to update existing overheadAdvance")
|
||||
this.overheadAdvance = await this.overheadAdvanceService.putOverheadAdvance(this.overheadAdvance)
|
||||
this.messageService.add(`Successfully changed overheadAdvance with id ${this.overheadAdvance.id}`)
|
||||
}
|
||||
this.router.navigate(['/overheadadvances'])
|
||||
} finally {
|
||||
this.submitButton.disabled = false
|
||||
}
|
||||
this.router.navigate(['/overheadadvances'])
|
||||
// this.submitButton.disabled = false
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user