Show correct building techs in search
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user