28 lines
874 B
TypeScript
28 lines
874 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { HttpClient } from '@angular/common/http';
|
|
import { Observable } from 'rxjs';
|
|
import { ConfigService } from '@services/config.service';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class HardwareProfileService {
|
|
private baseUrl: string;
|
|
private apiUrl: string;
|
|
|
|
constructor(
|
|
private http: HttpClient,
|
|
private configService: ConfigService
|
|
) {
|
|
this.baseUrl = this.configService.apiUrl;
|
|
this.apiUrl = `${this.baseUrl}/hardware-profiles`;
|
|
}
|
|
|
|
getHardwareProfile(id: string): Observable<any> {
|
|
return this.http.get<any>(`${this.baseUrl}${id}`);
|
|
}
|
|
|
|
getHardwareProfiles(page: number = 1, itemsPerPage: number = 10, filters: { [key: string]: string } = {}): Observable<any> {
|
|
return this.http.get<any>(`${this.apiUrl}?page=${page}&itemsPerPage=${itemsPerPage}`, { params: filters });
|
|
}
|
|
}
|