Revision 61265
Added by Argiro Kokogiannaki almost 3 years ago
modules/uoa-admin-portal/branches/angular-11/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.ts | ||
---|---|---|
155 | 155 |
const subjectsToDelete = this.getNonEmptyItems(subjectsToDeleteAr); |
156 | 156 |
const subjectsToAdd = this.getNonEmptyItems(subjectsToAddAr); |
157 | 157 |
if (subjectsToAdd.length > 0 && subjectsToDelete.length > 0) { |
158 |
const data = zip(this._subjectsService.addSubjects( |
|
159 |
this.properties.communityAPI + this.communityId + '/subjects', subjectsToAdd), |
|
160 |
this._subjectsService.removeSubjects( |
|
161 |
this.properties.communityAPI + this.communityId + '/subjects', subjectsToDelete)); |
|
162 |
this.subscriptions.push(data.subscribe(res => { |
|
163 |
this.afterUpdateActions(res, "updated"); |
|
164 |
}, |
|
165 |
error => this.handleUpdateError('System error updating subjects', error) |
|
166 |
)); |
|
158 |
this.subscriptions.push(this._subjectsService.removeSubjects( |
|
159 |
this.properties.communityAPI + this.communityId + '/subjects', subjectsToDelete).subscribe(res =>{ |
|
160 |
this.subscriptions.push(this._subjectsService.addSubjects( |
|
161 |
this.properties.communityAPI + this.communityId + '/subjects', subjectsToAdd).subscribe(res => { |
|
162 |
this.afterUpdateActions(res, "added"); |
|
163 |
})); |
|
164 |
})); |
|
167 | 165 |
} else if (subjectsToAdd.length > 0) { |
168 | 166 |
this.subscriptions.push(this._subjectsService.addSubjects( |
169 | 167 |
this.properties.communityAPI + this.communityId + '/subjects', subjectsToAdd).subscribe(res => { |
Also available in: Unified diff
[Admin portal| angular 11 branch]
Subjects: fix issue on update