argos/dmp-frontend/src/app/core/services/dashboard/dashboard.service.ts

33 lines
1.3 KiB
TypeScript

import { HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from '../../../../environments/environment';
import { DashboardStatisticsModel } from '../../model/dashboard/dashboard-statistics-model';
import { BaseHttpService } from '../http/base-http.service';
import { ConfigurationService } from '../configuration/configuration.service';
import { RecentActivityModel } from '@app/core/model/recent-activity/recent-activity.model';
@Injectable()
export class DashboardService {
private actionUrl: string;
private headers: HttpHeaders;
constructor(private http: BaseHttpService,
private configurationService: ConfigurationService) {
this.actionUrl = configurationService.server + 'dashboard/';
}
getStatistics(): Observable<DashboardStatisticsModel> {
return this.http.get<DashboardStatisticsModel>(this.actionUrl + 'getStatistics', { headers: this.headers });
}
getUserStatistics(): Observable<DashboardStatisticsModel> {
return this.http.get<DashboardStatisticsModel>(this.actionUrl + 'me/getStatistics', { headers: this.headers });
}
getRecentAcitvity(): Observable<RecentActivityModel[]> {
return this.http.get<RecentActivityModel[]>(this.actionUrl + 'recentActivity', {headers: this.headers});
}
}