[develop | DONE | FIX ] delete portal, pass the portal type of the first one

This commit is contained in:
argirok 2024-09-09 10:57:39 +03:00
parent 9826e5d358
commit 4727fb7a10
2 changed files with 8 additions and 5 deletions

View File

@ -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);

View File

@ -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));
}