[develop | DONE | FIX ] delete portal, pass the portal type of the first one
This commit is contained in:
parent
9826e5d358
commit
4727fb7a10
|
@ -131,7 +131,7 @@ export class PortalsComponent implements OnInit {
|
|||
|
||||
public confirmedDeletePortals(data: any) {
|
||||
this.showLoading = true;
|
||||
this.subscriptions.push(this._helpContentService.deleteCommunities(this.selectedPortals, this.properties.adminToolsAPIURL).subscribe(
|
||||
this.subscriptions.push(this._helpContentService.deleteCommunities(this.selectedPortals, this.properties.adminToolsAPIURL, this.getPortalType()).subscribe(
|
||||
_ => {
|
||||
this.deletePortalsFromArray(this.selectedPortals);
|
||||
NotificationHandler.rise('Portals have been <b>successfully deleted</b>');
|
||||
|
@ -141,7 +141,11 @@ export class PortalsComponent implements OnInit {
|
|||
error => this.handleUpdateError('System error deleting the selected communities', error)
|
||||
));
|
||||
}
|
||||
|
||||
getPortalType():string {
|
||||
let portalId = this.selectedPortals[0];
|
||||
let index = this.portals.findIndex(value => value._id === portalId);
|
||||
return this.portals[index].type;
|
||||
}
|
||||
public editPortal(i: number) {
|
||||
const portal: Portal = this.checkboxes[i].portal;
|
||||
this.index = this.portals.findIndex(value => value._id === portal._id);
|
||||
|
|
|
@ -406,11 +406,10 @@ export class HelpContentService {
|
|||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
deleteCommunities(ids : string[], helpContentUrl:string) {
|
||||
deleteCommunities(ids : string[], helpContentUrl:string, portalType:string) {
|
||||
// let headers = new Headers({'Content-Type': 'application/json'});
|
||||
// let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(helpContentUrl + properties.adminToolsPortalType + '/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
return this.http.post(helpContentUrl + '/' + portalType + '/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue