Search by layer number

This commit is contained in:
2023-06-25 19:08:26 +02:00
parent 69a9b200c5
commit f80ece56b1
5 changed files with 112 additions and 63 deletions

View File

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