[develop | DONE | ADDED] help-content.service.ts: add a function used in connect-admin, remove unused parameter from other functions

This commit is contained in:
Alex Martzios 2024-09-19 10:49:03 +03:00
parent 8f668cd4ff
commit 8f646a883f
1 changed files with 13 additions and 8 deletions

View File

@ -239,6 +239,12 @@ export class HelpContentService {
// .pipe(catchError(this.handleError));
// }
getCommunityPagesByRoute(pid: string, route: string) {
return this.http.get<Array<Page>>(properties.adminToolsAPIURL + properties.adminToolsPortalType + '/'+pid+'/pages'
+ (route ? '?page_route='+route : ''))
.pipe(map(pages => (pages.length>0?pages[0]:null)), catchError(this.handleError));
}
// Replacing getCommunityPages
getCommunityPagesByType(pid: string, type: string) {
return this.http.get<Array<Page>>(properties.adminToolsAPIURL + properties.adminToolsPortalType + '/'+pid+'/pages'
@ -305,7 +311,7 @@ export class HelpContentService {
.pipe(catchError(this.handleError));
}
togglePages(selectedPortalPid: string, ids : string[], status : boolean) {
togglePages(selectedPortalPid: string, ids : string[], status: boolean) {
return this.http.post(properties.adminToolsAPIURL + properties.adminToolsPortalType + '/' + selectedPortalPid + '/page/toggle?status='+ status.toString(),
JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
@ -432,22 +438,21 @@ export class HelpContentService {
.pipe(map(res => res['statistics']));
}
getCommunityAdminStatisticsChoices(apiUrl: string, portalId: string): Observable<StatisticsDisplay> {
const url = `${apiUrl}statistics/${portalId}`;
getCommunityAdminStatisticsChoices(portalId: string): Observable<StatisticsDisplay> {
const url = `${properties.adminToolsAPIURL}statistics/${portalId}`;
//console.log(`getting admin choices for statistics from: ${url}`);
return this.http.get<StatisticsDisplay>(url)
//.map(stats => <StatisticsDisplay>stats.json())
.pipe(catchError(this.handleError));
}
postCommunityAdminStatisticsChoices(apiUrl: string,
portalId: string,
postCommunityAdminStatisticsChoices(portalId: string,
entity: string,
chartsOrNumbers: string,
title: string,
status: boolean,
monitor: boolean): Observable<any> {
const url = `${apiUrl}statistics/${portalId}/${entity}/${chartsOrNumbers}?status=${status.toString()}&monitor=${monitor.toString()}`;
const url = `${properties.adminToolsAPIURL}statistics/${portalId}/${entity}/${chartsOrNumbers}?status=${status.toString()}&monitor=${monitor.toString()}`;
//console.log(`getting admin choices for statistics from: ${url}`);
return this.http.post(url, title, CustomOptions.getAuthOptionsWithBody())
@ -455,8 +460,8 @@ export class HelpContentService {
.pipe(catchError(this.handleError));
}
statisticsIsActiveToggle(apiURL: string, id: string): Observable<boolean> {
const url = apiURL + '/statistics/' + encodeURIComponent(id) + '/toggle';
statisticsIsActiveToggle(id: string): Observable<boolean> {
const url = properties.adminToolsAPIURL + 'statistics/' + encodeURIComponent(id) + '/toggle';
return this.http.post<boolean>(url, {}, CustomOptions.getAuthOptionsWithBody()).pipe(catchError(this.handleError));
}
}