Show correct building techs in search

This commit is contained in:
2026-05-25 14:57:06 +02:00
parent bfdcab8be3
commit adac2e04bb
2 changed files with 9 additions and 4 deletions

View File

@@ -37,18 +37,22 @@ export default class extends Controller {
const response = await fetch(`${GisState.apiUrl}/search?` + new URLSearchParams(body));
const results = await response.json();
console.warn(body);
this.containerTarget.classList.remove('is-hidden');
this.#injectResults(results);
if (results.length) {
// Reset zoom level after successful search
map.setZoom(INIT_ZOOM);
this.#filterMap(results);
console.debug(results);
// Should technique always be shown after a search?
for (const key of Object.keys(techsMarkers)) {
if (techsMarkers[key].options.label === body.technique)
map.addLayer(techsMarkers[key]);
for (const record of results) {
// Adjust for non-site records!!
if (techsMarkers[key].options.site === record.label)
map.addLayer(techsMarkers[key]);
}
}
}
}