InfiniteScroll and Layer list filter

This commit is contained in:
Michał Zieliński
2023-10-20 13:56:40 +02:00
parent a358dc75cf
commit a96ca6a795
9 changed files with 227 additions and 201 deletions

View File

@@ -76,13 +76,9 @@ export class Layer extends Base {
});
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static getList(_http: HttpClient, start: number, limit: number, codes: string[]): any {
static getList(_http: HttpClient, start: number, limit: number, name: string, type: LayerType | ''): any {
return new Promise((resolve, reject) => {
let codesQuery = "";
if (codes.length) {
codesQuery = `&${codes.map(x => `codes=${x}`).join('&')}`;
}
_http.get<Layer[]>(`${environment.api.url}/layers?start=${start}&limit=${limit}${codesQuery}`)
_http.get<Layer[]>(`${environment.api.url}/layers?start=${start}&limit=${limit}&name=${name}&type=${type}`)
.pipe(map(data => data.map(x => new Layer().deserialize(x))))
.subscribe({
next: (data) => resolve(data),