2020-12-05 07:29:18 +01:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
import {BehaviorSubject} from 'rxjs';
|
2021-02-17 13:49:04 +01:00
|
|
|
import {environment} from '@src/environments/environment';
|
2020-12-05 07:29:18 +01:00
|
|
|
import {first} from 'rxjs/operators';
|
2021-03-15 06:53:33 +01:00
|
|
|
import {HttpWrapperService} from '@app/_services/http-wrapper.service';
|
2020-12-05 07:29:18 +01:00
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
providedIn: 'root'
|
|
|
|
})
|
|
|
|
export class LocationService {
|
|
|
|
locations: any = '';
|
|
|
|
private locationsList = new BehaviorSubject<any>(this.locations);
|
|
|
|
locationsSubject = this.locationsList.asObservable();
|
|
|
|
|
|
|
|
constructor(
|
2021-03-14 09:19:25 +01:00
|
|
|
private httpWrapperService: HttpWrapperService,
|
2020-12-05 07:29:18 +01:00
|
|
|
) { }
|
|
|
|
|
|
|
|
getLocations(): void {
|
2021-03-14 09:19:25 +01:00
|
|
|
this.httpWrapperService.get(`${environment.cicCacheUrl}/locations`).pipe(first()).subscribe(res => this.locationsList.next(res.body));
|
2020-12-05 07:29:18 +01:00
|
|
|
}
|
|
|
|
}
|