mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 02:44:02 +00:00
refactor(app): share application components and request services
This commit is contained in:
1 parent
a0a0128a59
commit
a67bc60a29
84 files changed
+2798
-1731
No files matched your search
+3
-9
@@ -1,3 +1,4 @@
|
||||
import { applicationServices } from './services/application.js';
|
||||
import * as Cesium from 'cesium';
|
||||
import {
|
||||
viewportBias,
|
||||
@@ -1345,15 +1346,8 @@ async function resolveBuildingBounds(lat, lon, query) {
|
||||
const controller = new AbortController();
|
||||
const timeout = window.setTimeout(() => controller.abort(), 6000);
|
||||
try {
|
||||
const response = await fetch('/api/overpass', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: `data=${encodeURIComponent(overpassQuery)}`,
|
||||
signal: controller.signal,
|
||||
});
|
||||
if (!response.ok) return null;
|
||||
const data = await response.json();
|
||||
return selectBuildingBounds(data?.elements || [], lat, lon, query);
|
||||
const elements = await applicationServices.boundaries.query(overpassQuery, { signal: controller.signal });
|
||||
return selectBuildingBounds(Array.isArray(elements) ? elements : [], lat, lon, query);
|
||||
} catch {
|
||||
return null;
|
||||
} finally {
|
||||
|
||||
Reference in new issue
Block a user