mirror of
https://github.com/mempool/mempool.git
synced 2025-02-24 22:58:30 +01:00
Only query lightning search if more than 3 characters
This commit is contained in:
parent
f3bd50d4ab
commit
0b953f21b0
1 changed files with 6 additions and 2 deletions
|
@ -403,9 +403,13 @@ export class ApiService {
|
|||
return this.httpClient.get<any[]>(this.apiBaseUrl + this.apiBasePath + '/api/v1/lightning/channels/txids/', { params });
|
||||
}
|
||||
|
||||
lightningSearch$(searchText: string): Observable<any[]> {
|
||||
lightningSearch$(searchText: string): Observable<{ nodes: any[], channels: any[] }> {
|
||||
let params = new HttpParams().set('searchText', searchText);
|
||||
return this.httpClient.get<any[]>(this.apiBaseUrl + this.apiBasePath + '/api/v1/lightning/search', { params });
|
||||
// Don't request the backend if searchText is less than 3 characters
|
||||
if (searchText.length < 3) {
|
||||
return of({ nodes: [], channels: [] });
|
||||
}
|
||||
return this.httpClient.get<{ nodes: any[], channels: any[] }>(this.apiBaseUrl + this.apiBasePath + '/api/v1/lightning/search', { params });
|
||||
}
|
||||
|
||||
getNodesPerIsp(): Observable<any> {
|
||||
|
|
Loading…
Add table
Reference in a new issue