Added fetch for single employee and prepared data for access-groups
This commit is contained in:
@@ -12,14 +12,16 @@ function filterEmployees(employees: Employee[], searchFilter: string): Employee[
|
||||
return employees.filter(person => person.fullName.toLowerCase().includes(searchFilter.toLowerCase()));
|
||||
}
|
||||
|
||||
const API_HEADERS = { headers: environment.api.headers };
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class EmployeeService {
|
||||
private _employeesApiUrl = `${environment.api.meet}/employees`;
|
||||
private _employeeApiUrl = `${environment.api.meet}/employee`;
|
||||
private _employeesRawData: Observable<EmployeesApiResponse> = this.httpClient.get<EmployeesApiResponse>(
|
||||
this._employeesApiUrl,
|
||||
{ headers: environment.api.headers }
|
||||
API_HEADERS
|
||||
);
|
||||
private _allEmployees$: Observable<Employee[]> = this._employeesRawData.pipe(
|
||||
map(({ pxResults }) => pxResults.map(result => mapEmployeeReponseToEmployee(result)))
|
||||
@@ -47,7 +49,9 @@ export class EmployeeService {
|
||||
constructor(private httpClient: HttpClient) {}
|
||||
|
||||
public getDetailedEmployeeData(id: string): Observable<Employee> {
|
||||
return this.httpClient.get<Employee>(`${this._employeesApiUrl}/${id}`, { params: { _embed: 'participants' } });
|
||||
return this.httpClient
|
||||
.get<EmployeesApiResponse>(`${this._employeeApiUrl}/${id}`, API_HEADERS)
|
||||
.pipe(map(({ pxResults }) => mapEmployeeReponseToEmployee(pxResults[0])));
|
||||
}
|
||||
|
||||
public setSearchFilter(value: string) {
|
||||
|
||||
Reference in New Issue
Block a user