From 4727fb7a10f2b7842fd0edeee55707e6a4147881 Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 9 Sep 2024 10:57:39 +0300 Subject: [PATCH] [develop | DONE | FIX ] delete portal, pass the portal type of the first one --- dashboard/portal/portals.component.ts | 8 ++++++-- services/help-content.service.ts | 5 ++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dashboard/portal/portals.component.ts b/dashboard/portal/portals.component.ts index b3b205b1..6519bc59 100644 --- a/dashboard/portal/portals.component.ts +++ b/dashboard/portal/portals.component.ts @@ -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 successfully deleted'); @@ -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); diff --git a/services/help-content.service.ts b/services/help-content.service.ts index 701ff4be..1c24841b 100644 --- a/services/help-content.service.ts +++ b/services/help-content.service.ts @@ -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)); }