add map each and query params to get method
This commit is contained in:
parent
56ef15eecb
commit
eca1fd1b9c
@ -31,11 +31,11 @@ export abstract class GenericService<I> {
|
||||
return id ? this._getOne([id]) : this.getAll();
|
||||
}
|
||||
|
||||
@Validate()
|
||||
getAll<R = I[]>(modelPath = this._defaultModelPath): Observable<R> {
|
||||
getAll<R = I[]>(modelPath = this._defaultModelPath, queryParams?: List<QueryParam>): Observable<R> {
|
||||
return this._http.get<R>(`/${encodeURI(modelPath)}`, {
|
||||
headers: HeadersConfiguration.getHeaders({ contentType: false }),
|
||||
observe: 'body',
|
||||
params: this._queryParams(queryParams),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -9,5 +9,9 @@ export function any<T>(predicate: (value: T, index: number) => boolean): Operato
|
||||
return map(entities => entities.some(predicate));
|
||||
}
|
||||
|
||||
export function mapEach<T, R>(predicate: (value: T, index: number) => R): OperatorFunction<T[], R[]> {
|
||||
return map(entities => entities.map(predicate));
|
||||
}
|
||||
|
||||
export const toLengthValue = (entities: unknown[]): number => entities?.length ?? 0;
|
||||
export const getLength = pipe(map(toLengthValue), distinctUntilChanged());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user