Move country coder endpoint config into 'Constants'

This commit is contained in:
pietervdvn 2022-04-28 00:29:22 +02:00
parent 14956e229c
commit c202ba606b
2 changed files with 4 additions and 2 deletions

View file

@ -7,6 +7,7 @@ import Title from "../UI/Base/Title";
import {FixedUiElement} from "../UI/Base/FixedUiElement";
import LayerConfig from "../Models/ThemeConfig/LayerConfig";
import {CountryCoder} from "latlon2country"
import Constants from "../Models/Constants";
export class SimpleMetaTagger {
@ -40,7 +41,7 @@ export class SimpleMetaTagger {
}
export class CountryTagger extends SimpleMetaTagger {
private static readonly coder = new CountryCoder("https://raw.githubusercontent.com/pietervdvn/MapComplete-data/main/latlon2country", Utils.downloadJson);
private static readonly coder = new CountryCoder(Constants.countryCoderEndpoint, Utils.downloadJson);
public runningTasks: Set<any>;
constructor() {
@ -217,7 +218,7 @@ export default class SimpleMetaTaggers {
},
((feature, _, __, state) => {
const units = Utils.NoNull([].concat(...state?.layoutToUse?.layers?.map(layer => layer.units ?? [])));
const units = Utils.NoNull([].concat(...state?.layoutToUse?.layers?.map(layer => layer.units )?? []));
if (units.length == 0) {
return;
}

View file

@ -69,6 +69,7 @@ export default class Constants {
* In seconds
*/
static zoomToLocationTimeout = 60;
static countryCoderEndpoint: string = "https://raw.githubusercontent.com/pietervdvn/MapComplete-data/main/latlon2country";
private static isRetina(): boolean {
if (Utils.runningFromConsole) {