monitor/src/app/htmlPages/htmlPage.service.ts

26 lines
870 B
TypeScript

import {Injectable, Inject} from '@angular/core';
import {HttpClient} from "@angular/common/http";
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import{EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
@Injectable()
export class HtmlPageService {
constructor(private http: HttpClient) {}
getHtmlContent (router: string, properties:EnvProperties, communityId:string ):any {
//console.info("get router html content for : "+router);
let url = properties.adminToolsAPIURL + '/htmlpagecontent?community='+communityId+'&page='+router;
return this.http.get<Array<any>>((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
//.map(res => <Array<any>> res.json());
}
}