mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2025-07-05 21:58:53 +00:00
implemented reset of config
This commit is contained in:
parent
2ee16f6452
commit
8a3bd49686
5 changed files with 47 additions and 4 deletions
21
data/reset.js
Normal file
21
data/reset.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
import { writeDataToInput } from "/load-data.js";
|
||||
|
||||
const form = document.querySelector("form");
|
||||
|
||||
form.addEventListener("reset", async (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
try {
|
||||
const res = await fetch("/reset", {
|
||||
method: "POST",
|
||||
});
|
||||
if (!res.ok) {
|
||||
throw new Error(`Response status: ${res.status}`);
|
||||
}
|
||||
|
||||
const json = await res.json();
|
||||
writeDataToInput(json);
|
||||
} catch (error) {
|
||||
console.error(error.message);
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue