refactor: initialize config via APP_INITIALIZER

Closes #181
This commit is contained in:
Jovan Krunić
2022-02-09 20:43:08 +01:00
parent 411e0970b8
commit bde0df219c
9 changed files with 37 additions and 72 deletions

View File

@@ -26,6 +26,7 @@ import {divIcon, geoJSON, icon, LatLng, Map, marker, Marker} from 'leaflet';
import {DataProvider} from '../data/data.provider';
import {MapPosition, PositionService} from './position.service';
import {hasValidLocation} from '../data/types/place/place-types';
import {ConfigProvider} from '../config/config.provider';
/**
* Provides methods for presenting the map
@@ -107,7 +108,12 @@ export class MapProvider {
constructor(
private dataProvider: DataProvider,
private positionService: PositionService,
) {}
private configProvider: ConfigProvider,
) {
this.defaultPolygon = this.configProvider.getValue(
'campusPolygon',
) as Polygon;
}
/**
* Provide the specific place by its UID
@@ -128,7 +134,7 @@ export class MapProvider {
/**
* Provide places (buildings and canteens) const result = await this.dataProvider.search(query);
*
* @param contextFilter Additional contextual filter (e.g. from the context menu)
* @param queryText Query (text) of the search query