re-enable submit button in finally block
This commit is contained in:
@ -52,16 +52,22 @@ export class CommercialUnitDetailsComponent implements OnInit {
|
||||
}
|
||||
|
||||
async saveCommercialPremise() {
|
||||
this.submitButton.disabled = true
|
||||
this.messageService.add(`saveCommercialPremise: ${ JSON.stringify(this.commercialPremise, undefined, 4) }`)
|
||||
if (this.commercialPremise.id == 0) {
|
||||
this.messageService.add("about to insert new commercialPremise")
|
||||
this.commercialPremise = await this.commercialPremiseService.postCommercialPremise(this.commercialPremise)
|
||||
this.messageService.add(`Successfully added flat with id ${this.commercialPremise.id}`)
|
||||
} else {
|
||||
this.messageService.add("about to update existing commercialPremise")
|
||||
try {
|
||||
this.submitButton.disabled = true
|
||||
this.messageService.add(`saveCommercialPremise: ${ JSON.stringify(this.commercialPremise, undefined, 4) }`)
|
||||
if (this.commercialPremise.id == 0) {
|
||||
this.messageService.add("about to insert new commercialPremise")
|
||||
this.commercialPremise = await this.commercialPremiseService.postCommercialPremise(this.commercialPremise)
|
||||
this.messageService.add(`Successfully added commercialPremise with id ${this.commercialPremise.id}`)
|
||||
} else {
|
||||
this.messageService.add("about to update existing commercialPremise")
|
||||
this.commercialPremise = await this.commercialPremiseService.putCommercialPremise(this.commercialPremise)
|
||||
this.messageService.add(`Successfully changed commercialPremise with id ${this.commercialPremise.id}`)
|
||||
}
|
||||
this.router.navigate(['/commercialunits'])
|
||||
} finally {
|
||||
this.submitButton.disabled = false
|
||||
}
|
||||
this.router.navigate(['/commercialunits'])
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user