Updated avrop loading

This commit is contained in:
Erik Tiekstra
2021-09-20 09:53:00 +02:00
parent 1feed30f6f
commit bfffed4099
11 changed files with 46 additions and 19 deletions

View File

@@ -104,7 +104,7 @@
justify-content: center;
align-items: center;
background-color: var(--digi--ui--color--background--tertiary);
height: 70px;
padding: $digi--layout--gutter $digi--layout--gutter--l;
}
&__no-options-available {

View File

@@ -5,7 +5,7 @@ import { Handledare } from '@msfa-models/handledare.model';
import { AvropApiService } from '@msfa-services/api/avrop-api.service';
import { MultiselectFilterOption } from '@msfa-shared/components/multiselect/multiselect-filter-option';
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
import { filter, map, switchMap } from 'rxjs/operators';
import { filter, map, switchMap, tap } from 'rxjs/operators';
type Step = 1 | 2 | 3 | 4;
@@ -24,6 +24,8 @@ export class AvropService {
private _handledareIsConfirmed$ = new BehaviorSubject<boolean>(false);
private _avropIsSubmitted$ = new BehaviorSubject<boolean>(false);
private _error$ = new BehaviorSubject<string>(null);
private _avropLoading$ = new BehaviorSubject<boolean>(false);
public avropLoading$: Observable<boolean> = this._avropLoading$.asObservable();
public filteredTjanster$: Observable<MultiselectFilterOption[]> = this._filteredTjanster$.asObservable();
public filteredUtforandeVerksamheter$: Observable<
@@ -50,7 +52,16 @@ export class AvropService {
this._filteredKommuner$,
this._page$,
this._limit$,
]).pipe(switchMap(() => this.avropApiService.fetchAvrop$(this.filtersForAvrop)));
]).pipe(
switchMap(() => {
this._avropLoading$.next(true);
return this.avropApiService.fetchAvrop$(this.filtersForAvrop).pipe(
tap(() => {
this._avropLoading$.next(false);
})
);
})
);
public availableTjanster$: Observable<MultiselectFilterOption[]> = combineLatest([
this._filteredUtforandeVerksamheter$,