summaryrefslogtreecommitdiff
path: root/src/Api/api.ts
diff options
context:
space:
mode:
authorAlexander NeonXP Kiryukhin <a.kiryukhin@mail.ru>2019-06-10 03:15:51 +0300
committerAlexander NeonXP Kiryukhin <a.kiryukhin@mail.ru>2019-06-10 03:15:51 +0300
commit06645cdac4184f5c1cf50f2a4b94be3d72d634f0 (patch)
tree1eb62ec1d2275ae6feb90cfceedb7b93257005b0 /src/Api/api.ts
parent4b01d81d3daed894bc93f77dbbbe5501a4552447 (diff)
More improvements
Diffstat (limited to 'src/Api/api.ts')
-rw-r--r--src/Api/api.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Api/api.ts b/src/Api/api.ts
index 4c83252..1fd9435 100644
--- a/src/Api/api.ts
+++ b/src/Api/api.ts
@@ -153,11 +153,11 @@ const pointToTileId = (x: number, y: number, params: TileParameters): string =>
return params.zoom + "_" + x + "_" + y + "_" + params.level + "_8_100";
}
-const getZoomByRegion = (width: number, region: Region): number => {
+export const getZoomByRegion = (width: number, region: Region): number => {
return Math.ceil(Math.log2(360 * ((width / 256) / region.longitudeDelta))) + 1
}
-const getDataZoomForMapZoom = (zoom: number): number => {
+export const getDataZoomForMapZoom = (zoom: number): number => {
if (zoom > 21) {
zoom = 21;
}
@@ -223,9 +223,9 @@ const getEntities = (tileKeys: string[], params: RequestParams): Promise<GetEnti
"body": JSON.stringify({ tileKeys, v: params.v }),
"method": "POST",
})
- return timeout(10000, promise.then(r => {
+ return timeout(30000, promise.then(async r => {
if (r.status != 200) {
- return { result: { map: {} } }
+ throw Error(r.statusText)
}
return r.json()
}))