src/app/shared/widgets/portal/config/config.service.ts
Widget inputs |
Widget outputs |
Properties |
|
Methods |
constructor(widgetframeService: WidgetframeService)
|
||||||
Parameters :
|
getThemes |
getThemes()
|
Returns :
Observable<any[]>
|
getTinyConfig |
getTinyConfig()
|
Returns :
Observable<string>
|
Private themesObservable |
themesObservable:
|
Private tinyObservable |
tinyObservable:
|
Public widgetframeService |
widgetframeService:
|
Type : WidgetframeService
|
import { Injectable } from "@angular/core";
import { Observable, Subject } from "rxjs";
import { WidgetframeService } from "../../widgetframe/widgetframe.service";
import { first, map, shareReplay } from "rxjs/operators";
export const themesUrl = "/api/public/configuration/themes";
export const tinyUrl = "/api/public/configuration/tiny";
@Injectable()
export class ConfigService {
private themesObservable;
private tinyObservable;
constructor(public widgetframeService: WidgetframeService) {
this.themesObservable = this.widgetframeService.getData(themesUrl).pipe(
map((data) => data._embedded.themes),
shareReplay()
);
this.tinyObservable = this.widgetframeService
.getData(tinyUrl)
.pipe(shareReplay());
}
getThemes(): Observable<any[]> {
return this.themesObservable.pipe(first());
}
getTinyConfig(): Observable<string> {
return this.tinyObservable.pipe(first());
}
}