create-schematic-gen-site/site/files.js

18 lines
497 B
JavaScript
Raw Normal View History

2023-07-15 22:22:48 +00:00
const form = document.getElementById("schematic-form");
form.onsubmit = async (e) => {
e.preventDefault();
console.log(e);
const data = new FormData(form);
console.log(data);
try {
const response = await fetch("/extracts", {
method: "POST",
body: data
});
const result = await response.json();
console.log("Success:", result);
form.reset();
} catch (error) {
console.error("Error: " + error);
}
};