option to insert new tenant

This commit is contained in:
2021-08-31 10:51:08 +02:00
parent af0e4ffd74
commit e238b1fb9f
5 changed files with 20 additions and 5 deletions

View File

@ -39,15 +39,22 @@ export class TenantDetailsComponent implements OnInit {
async getTenant(): Promise<void> {
try {
const id = +this.route.snapshot.paramMap.get('id')
this.tenant = await this.tenantService.getTenant(id)
if (id != 0) {
this.tenant = await this.tenantService.getTenant(id)
}
} catch (err) {
this.messageService.add(JSON.stringify(err, undefined, 4))
}
}
updateTenant() {
this.messageService.add("updateTenant")
saveTenant() {
this.messageService.add("saveTenant")
this.messageService.add(JSON.stringify(this.tenant, undefined, 4))
if (this.tenant.id == 0) {
this.messageService.add("about to insert new tenant")
} else {
this.messageService.add("about to update existing tenant")
}
}
ngOnInit(): void {