isdashboard/src/main/webapp/app/services/contexts-loader.service.ts

27 lines
869 B
TypeScript

import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { appProperties } from 'app/config/app-properties';
import { IContextNode } from './i-context-node';
@Injectable({
providedIn: 'root',
})
export class ContextsLoaderService {
httpOptions = {
headers: new HttpHeaders({ 'Content-Type': 'application/json' }),
};
constructor(private http: HttpClient) {}
getData(): Observable<IContextNode[]> {
//TODO: pipe per gestione errori
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
return this.http.get<IContextNode[]>(appProperties.BASEURL_API + 'is/allcontext');
}
getRawData(): Observable<string> {
//TODO: pipe per gestione errori
return this.http.get<string>(appProperties.BASEURL_API + 'is/allcontext');
}
}