Issue: #109
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { CityAndStateResult, CountyResult, GeoResult } from '../../../../bizmatch-server/src/models/main.model';
|
||||
import { Place } from '../../../../bizmatch-server/src/models/server.model';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
@Injectable({
|
||||
@@ -9,6 +10,7 @@ import { environment } from '../../environments/environment';
|
||||
})
|
||||
export class GeoService {
|
||||
private apiBaseUrl = environment.apiBaseUrl;
|
||||
private baseUrl: string = 'https://nominatim.openstreetmap.org/search';
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
findCitiesStartingWith(prefix: string, state?: string): Observable<GeoResult[]> {
|
||||
@@ -21,4 +23,8 @@ export class GeoService {
|
||||
findCountiesStartingWith(prefix: string, states?: string[]): Observable<CountyResult[]> {
|
||||
return this.http.post<CountyResult[]>(`${this.apiBaseUrl}/bizmatch/geo/counties`, { prefix, states });
|
||||
}
|
||||
findLocationStartingWith(prefix: string): Observable<Place[]> {
|
||||
let headers = new HttpHeaders().set('X-Hide-Loading', 'true').set('Accept-Language', 'en-US');
|
||||
return this.http.get(`${this.baseUrl}?q=${prefix},US&format=json&addressdetails=1&limit=5`, { headers }) as Observable<Place[]>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
|
||||
import { BehaviorSubject, lastValueFrom, Observable } from 'rxjs';
|
||||
import urlcat from 'urlcat';
|
||||
import { User } from '../../../../bizmatch-server/src/models/db.model';
|
||||
import { ResponseUsersArray, StatesResult, UserListingCriteria } from '../../../../bizmatch-server/src/models/main.model';
|
||||
import { ResponseUsersArray, UserListingCriteria } from '../../../../bizmatch-server/src/models/main.model';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
@Injectable({
|
||||
@@ -46,7 +46,7 @@ export class UserService {
|
||||
getNumberOfBroker(criteria?: UserListingCriteria): Observable<number> {
|
||||
return this.http.post<number>(`${this.apiBaseUrl}/bizmatch/user/findTotal`, criteria);
|
||||
}
|
||||
async getAllStates(): Promise<any> {
|
||||
return await lastValueFrom(this.http.get<StatesResult[]>(`${this.apiBaseUrl}/bizmatch/user/states/all`));
|
||||
}
|
||||
// async getAllStates(): Promise<any> {
|
||||
// return await lastValueFrom(this.http.get<StatesResult[]>(`${this.apiBaseUrl}/bizmatch/user/states/all`));
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user