geo coding, user service, listing for business
This commit is contained in:
18
bizmatch/src/app/services/geo.service.ts
Normal file
18
bizmatch/src/app/services/geo.service.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from '../../environments/environment';
|
||||
import { Observable } from 'rxjs';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
export interface GeoResult { city: string; state: string; state_code: string }
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class GeoService {
|
||||
|
||||
private apiBaseUrl = environment.apiBaseUrl;
|
||||
constructor(private http: HttpClient) { }
|
||||
|
||||
findCitiesStartingWith(prefix:string, state?:string):Observable<GeoResult[]>{
|
||||
const stateString = state?`/${state}`:''
|
||||
return this.http.get<GeoResult[]>(`${this.apiBaseUrl}/bizmatch/geo/${prefix}${stateString}`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user