mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2025-05-18 21:55:34 +00:00
added confirm dialog
This commit is contained in:
parent
8a3bd49686
commit
5620d966d1
1 changed files with 10 additions and 1 deletions
|
@ -5,6 +5,15 @@ const form = document.querySelector("form");
|
|||
form.addEventListener("reset", async (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
const ok = confirm(
|
||||
"Sicher, dass du alle Einstellungen zurücksetzen möchtest?"
|
||||
);
|
||||
if (ok) {
|
||||
reset();
|
||||
}
|
||||
});
|
||||
|
||||
async function reset() {
|
||||
try {
|
||||
const res = await fetch("/reset", {
|
||||
method: "POST",
|
||||
|
@ -18,4 +27,4 @@ form.addEventListener("reset", async (event) => {
|
|||
} catch (error) {
|
||||
console.error(error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue