From 3553ce4d0d0062625fe0a180ff08eb46dcbec31f Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 10 Feb 2022 10:15:32 +0200 Subject: [PATCH] Fix upload bug when creating a stakeholder. --- src/app/general/edit-stakeholder/edit-stakeholder.component.ts | 3 ++- src/app/manageStakeholders/manageStakeholders.component.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/general/edit-stakeholder/edit-stakeholder.component.ts b/src/app/general/edit-stakeholder/edit-stakeholder.component.ts index 78a4436..4ba884c 100644 --- a/src/app/general/edit-stakeholder/edit-stakeholder.component.ts +++ b/src/app/general/edit-stakeholder/edit-stakeholder.component.ts @@ -280,7 +280,8 @@ export class EditStakeholderComponent implements OnDestroy { public save(callback: Function, errorCallback: Function = null) { if (this.file) { this.stakeholderFb.get('alias').enable(); - this.subscriptions.push(this.utilsService.uploadPhoto(this.properties.utilsService + "/upload/" + encodeURIComponent(this.stakeholder.type) + "/" + encodeURIComponent(this.stakeholderFb.value.alias), this.file).subscribe(res => { + this.stakeholderFb.get('type').enable(); + this.subscriptions.push(this.utilsService.uploadPhoto(this.properties.utilsService + "/upload/" + encodeURIComponent(this.stakeholderFb.value.type) + "/" + encodeURIComponent(this.stakeholderFb.value.alias), this.file).subscribe(res => { this.deletePhoto(); this.stakeholderFb.get('logoUrl').setValue(res.filename); this.removePhoto(); diff --git a/src/app/manageStakeholders/manageStakeholders.component.ts b/src/app/manageStakeholders/manageStakeholders.component.ts index d2d6fa8..94be789 100644 --- a/src/app/manageStakeholders/manageStakeholders.component.ts +++ b/src/app/manageStakeholders/manageStakeholders.component.ts @@ -246,12 +246,12 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy { timeout: 6000, pos: 'bottom-right' }); - this.alias = this.alias.filter(item => item !== this.stakeholder.alias); if (!this.stakeholder.defaultId) { this.defaultStakeholders.splice(this.index, 1); } else { this.stakeholders.splice(this.index, 1); } + this.alias = this.alias.filter(item => item !== this.stakeholder.alias); }, error => { UIkit.notification('An error has occurred. Please try again later', { status: 'danger',