feat(employees): Implemented loader inside employees-list when pagination/filtering. (TV-597)

Squashed commit of the following:

commit 9e41609f515909fac8618f8cae9ce29409e62748
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date:   Thu Sep 16 07:36:21 2021 +0200

    Removed old classes

commit 7be9f46dcd08be3cdec5e92bb237ad8fa6d1c373
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date:   Wed Sep 15 14:23:53 2021 +0200

    Added new loader component and implmented loader inside employees-list
This commit is contained in:
Erik Tiekstra
2021-09-16 10:09:14 +02:00
parent 3bfb8d8be1
commit bc8b09d0dc
17 changed files with 99 additions and 30 deletions

View File

@@ -44,6 +44,8 @@ export class EmployeeService extends UnsubscribeDirective {
public lastDeletedEmployee$: Observable<Employee> = this._lastDeletedEmployee$.asObservable();
private _employeeToDelete$ = new BehaviorSubject<Employee>(null);
public employeeToDelete$: Observable<Employee> = this._employeeToDelete$.asObservable();
private _employeesLoading$ = new BehaviorSubject<boolean>(false);
public employeesLoading$: Observable<boolean> = this._employeesLoading$.asObservable();
constructor(private httpClient: HttpClient, private errorService: ErrorService) {
super();
@@ -110,11 +112,13 @@ export class EmployeeService extends UnsubscribeDirective {
if (onlyEmployeesWithoutAuthorization) {
params.onlyEmployeesWithoutAuthorization = onlyEmployeesWithoutAuthorization?.toString();
}
this._employeesLoading$.next(true);
return this.httpClient
.get<EmployeesDataResponse>(this._apiBaseUrl, { params })
.pipe(
map(({ data, meta }) => {
this._employeesLoading$.next(false);
return { data: data.map(employee => mapResponseToEmployeeCompact(employee)), meta };
})
);