Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (26 sloc) 1.08 KB
import { Injectable } from '@angular/core';
import { Http, Response, Headers } from '@angular/http';
import { HomeDetails } from '../models/home.details.interface';
import { ConfigService } from '../../shared/utils/config.service';
import {BaseService} from '../../shared/services/base.service';
import { Observable } from 'rxjs/Rx';
//import * as _ from 'lodash';
// Add the RxJS Observable operators we need in this app.
import '../../rxjs-operators';
@Injectable()
export class DashboardService extends BaseService {
baseUrl: string = '';
constructor(private http: Http, private configService: ConfigService) {
super();
this.baseUrl = configService.getApiURI();
}
getHomeDetails(): Observable<HomeDetails> {
let headers = new Headers();
headers.append('Content-Type', 'application/json');
let authToken = localStorage.getItem('auth_token');
headers.append('Authorization', `Bearer ${authToken}`);
return this.http.get(this.baseUrl + "/dashboard/home",{headers})
.map(response => response.json())
.catch(this.handleError);
}
}