fixed dossier stats for user-admin
This commit is contained in:
parent
bfea73bb87
commit
395bd4e5f0
@ -1,9 +1,10 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HeadersConfiguration, mapEach, RequiredParam, Validate } from '@iqser/common-ui';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { BehaviorSubject, Observable, of } from 'rxjs';
|
||||
import { DossierStats, IDossierStats } from '@red/domain';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { UserService } from '@services/user.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@ -11,10 +12,13 @@ import { tap } from 'rxjs/operators';
|
||||
export class DossierStatsService {
|
||||
private readonly _map = new Map<string, BehaviorSubject<DossierStats>>();
|
||||
|
||||
constructor(private readonly _http: HttpClient) {}
|
||||
constructor(private readonly _http: HttpClient, private readonly _userService: UserService) {}
|
||||
|
||||
@Validate()
|
||||
getFor(@RequiredParam() dossierIds: string[]): Observable<DossierStats[]> {
|
||||
if (!this._userService.currentUser.isUser) {
|
||||
return of([]);
|
||||
}
|
||||
const request = this._http.post<IDossierStats[]>(`/${encodeURI('dossier-stats')}`, dossierIds, {
|
||||
headers: HeadersConfiguration.getHeaders(),
|
||||
observe: 'body',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user