Project

General

Profile

1
import { HttpClient, HttpHeaders } from '@angular/common/http';
2
import { Injectable } from '@angular/core';
3
import { Observable } from 'rxjs';
4
import { OverviewData } from '../domain/overview-data';
5

    
6
const headerOptions = {
7
  headers : new HttpHeaders().set('Content-Type', 'application/json')
8
    .set('Accept', 'application/json'),
9
};
10

    
11
@Injectable ()
12
export class DataService {
13
  // private _jsonURl = environment.API_ENDPOINT + '/monitor/';
14
  // private _jsonURl = '/assets/json/';
15
  private _jsonURl = 'http://esperos.di.uoa.gr/oss.json';
16

    
17
  constructor(private httpClient: HttpClient) {
18
  }
19

    
20
  public getOverviewData(): Observable<OverviewData> {
21
    return this.httpClient.get<OverviewData>(this._jsonURl, headerOptions);
22
  }
23

    
24
  // public getOverviewData(): Observable<OverviewData> {
25
  //   return ;
26
  // }
27
}
(1-1/2)