const form = document.getElementById("schematic-form"); const resultContainer = document.getElementById("result-container"); form.onsubmit = async (e) => { e.preventDefault(); resultContainer.innerHTML = "
Uploading and extracting contents...
"; const data = new FormData(form); try { const response = await fetch("/extracts", { method: "POST", body: data }); const result = await response.json(); const extractId = result.extractId; const url = window.location.origin + "/extracts/" + extractId; resultContainer.innerHTML = `Copy this URL, and provide it to the computer: ${url}
`; form.reset(); } catch (error) { console.error("Error: " + error); resultContainer.innerHTML = `An error occurred: ${error}
`; } };