import { StatisticResponse } from './../models/statisticResponse';
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class StatisticService {

  constructor(private http : HttpClient) { }


//  header de requete http
private headers = new HttpHeaders(
  // {  'Access-Control-Allow-Origin':'*',
  // // 'Access-Control-Allow-Headers': 'X-Requested-With, Content-Type',
  // // {'Content-Type': 'application/json',}
  // // 'Access-Control-Allow-Methods': 'POST, GET',
  //  }
);


// get statistic
getStatistic(): Observable<StatisticResponse> {
//  return this.http.get<StatisticResponse>('assets/data/stat.json');
const options = { headers: this.headers};
 let data = this.http.get<StatisticResponse>('environment.apiUrl/api/tickets/stats',options);
 console.log(JSON.stringify(data));
 return data;
 
}




}

