Fix upload bug when creating a stakeholder.

This commit is contained in:
Konstantinos Triantafyllou 2022-02-10 10:15:32 +02:00
parent 85b1fc7a9a
commit 3553ce4d0d
2 changed files with 3 additions and 2 deletions

View File

@ -280,7 +280,8 @@ export class EditStakeholderComponent implements OnDestroy {
public save(callback: Function, errorCallback: Function = null) { public save(callback: Function, errorCallback: Function = null) {
if (this.file) { if (this.file) {
this.stakeholderFb.get('alias').enable(); 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.deletePhoto();
this.stakeholderFb.get('logoUrl').setValue(res.filename); this.stakeholderFb.get('logoUrl').setValue(res.filename);
this.removePhoto(); this.removePhoto();

View File

@ -246,12 +246,12 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
timeout: 6000, timeout: 6000,
pos: 'bottom-right' pos: 'bottom-right'
}); });
this.alias = this.alias.filter(item => item !== this.stakeholder.alias);
if (!this.stakeholder.defaultId) { if (!this.stakeholder.defaultId) {
this.defaultStakeholders.splice(this.index, 1); this.defaultStakeholders.splice(this.index, 1);
} else { } else {
this.stakeholders.splice(this.index, 1); this.stakeholders.splice(this.index, 1);
} }
this.alias = this.alias.filter(item => item !== this.stakeholder.alias);
}, error => { }, error => {
UIkit.notification('An error has occurred. Please try again later', { UIkit.notification('An error has occurred. Please try again later', {
status: 'danger', status: 'danger',