diff --git a/src/app/services/config.service.ts b/src/app/services/config.service.ts new file mode 100644 index 0000000..5bda6d3 --- /dev/null +++ b/src/app/services/config.service.ts @@ -0,0 +1,25 @@ +import { Injectable } from '@angular/core'; +import { environment } from '../../environment'; +import { HttpClient } from '@angular/common/http'; +import { AuthService } from './auth.service'; +import { Observable } from 'rxjs'; +import { SystemConfig } from '../model/SystemConfig'; + +@Injectable({ + providedIn: 'root', +}) +export class ConfigService { + constructor(private http: HttpClient, private authService: AuthService) {} + + public loadConfig(): Observable { + return this.http.get(`${environment.apiURL}/admin/config`, { + headers: this.authService.getAuthHeaders(), + }); + } + + public saveConfig(config: SystemConfig): Observable { + return this.http.patch(`${environment.apiURL}/admin/config`, config, { + headers: this.authService.getAuthHeaders(), + }); + } +} diff --git a/src/app/services/statistics.service.ts b/src/app/services/statistics.service.ts new file mode 100644 index 0000000..c1a7041 --- /dev/null +++ b/src/app/services/statistics.service.ts @@ -0,0 +1,19 @@ +import { Injectable } from '@angular/core'; +import { environment } from '../../environment'; +import { HttpClient } from '@angular/common/http'; +import { Stats } from '../model/Stats'; +import { AuthService } from './auth.service'; +import { Observable } from 'rxjs'; + +@Injectable({ + providedIn: 'root', +}) +export class StatisticsService { + constructor(private http: HttpClient, private authService: AuthService) {} + + public loadStats(): Observable { + return this.http.get(`${environment.apiURL}/admin/stats`, { + headers: this.authService.getAuthHeaders(), + }); + } +}