33 lines
813 B
TypeScript
33 lines
813 B
TypeScript
import { HttpClient } from '@angular/common/http';
|
|
import { Component, OnInit } from '@angular/core';
|
|
import { Observable } from 'rxjs';
|
|
import { environment } from 'src/environments/environment';
|
|
|
|
export interface Statistics {
|
|
documents_total?: number
|
|
documents_inbox?: number
|
|
}
|
|
|
|
@Component({
|
|
selector: 'app-statistics-widget',
|
|
templateUrl: './statistics-widget.component.html',
|
|
styleUrls: ['./statistics-widget.component.css']
|
|
})
|
|
export class StatisticsWidgetComponent implements OnInit {
|
|
|
|
constructor(private http: HttpClient) { }
|
|
|
|
statistics: Statistics = {}
|
|
|
|
ngOnInit(): void {
|
|
this.getStatistics().subscribe(statistics => {
|
|
this.statistics = statistics
|
|
})
|
|
}
|
|
|
|
getStatistics(): Observable<Statistics> {
|
|
return this.http.get(`${environment.apiBaseUrl}statistics/`)
|
|
}
|
|
|
|
}
|