samgis / static /script.js
aletrn's picture
[feat] handle requests with errors
59ebac7
raw
history blame
574 Bytes
const coordsGenForm = document.querySelector(".coords-gen-form");
const segmentCoords = async (coords) => {
const inferResponse = await fetch(`infer_samgeo?input=${coords}`);
const inferJson = await inferResponse.json();
return inferJson.output;
};
coordsGenForm.addEventListener("submit", async (event) => {
event.preventDefault();
const coordsGenInput = document.getElementById("coords-gen-input");
const coordsGenParagraph = document.querySelector(".coords-gen-output");
coordsGenParagraph.coordsContent = await segmentCoords(coordsGenInput.value);
});