Added text if no deltagare could be found
This commit is contained in:
@@ -24,7 +24,7 @@ import { ReportsData } from '@msfa-models/reports.model';
|
||||
import { Sort } from '@msfa-models/sort.model';
|
||||
import { mapResponseToWorkExperience, WorkExperience } from '@msfa-models/work-experience.model';
|
||||
import { sortFromToDates } from '@msfa-utils/sort.util';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { BehaviorSubject, Observable, of } from 'rxjs';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
@@ -32,6 +32,8 @@ import { catchError, map } from 'rxjs/operators';
|
||||
})
|
||||
export class DeltagareApiService {
|
||||
private _apiBaseUrl = `${environment.api.url}/deltagare`;
|
||||
private _deltagareLoading$ = new BehaviorSubject<boolean>(false);
|
||||
public deltagareLoading$: Observable<boolean> = this._deltagareLoading$.asObservable();
|
||||
|
||||
constructor(private httpClient: HttpClient) {}
|
||||
|
||||
@@ -51,12 +53,16 @@ export class DeltagareApiService {
|
||||
if (onlyMyDeltagare) {
|
||||
params.onlyMyDeltagare = onlyMyDeltagare.toString();
|
||||
}
|
||||
|
||||
this._deltagareLoading$.next(true);
|
||||
|
||||
return this.httpClient
|
||||
.get<DeltagareCompactApiResponse>(this._apiBaseUrl, {
|
||||
params,
|
||||
})
|
||||
.pipe(
|
||||
map(({ data, meta }) => {
|
||||
this._deltagareLoading$.next(false);
|
||||
return { data: data.map(deltagare => mapResponseToDeltagareCompact(deltagare)), meta };
|
||||
}),
|
||||
catchError((error: Error) => {
|
||||
|
||||
@@ -16,6 +16,7 @@ export class DeltagareService {
|
||||
public sort$: Observable<Sort<keyof DeltagareCompact>> = this._sort$.asObservable();
|
||||
private _onlyMyDeltagare$ = new BehaviorSubject<boolean>(false);
|
||||
public onlyMyDeltagare$: Observable<boolean> = this._onlyMyDeltagare$.asObservable();
|
||||
public deltagareLoading$: Observable<boolean> = this.deltagareApiService.deltagareLoading$;
|
||||
public allDeltagareData$: Observable<DeltagareCompactData> = combineLatest([
|
||||
this._limit$,
|
||||
this._page$,
|
||||
|
||||
Reference in New Issue
Block a user