mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2025-07-04 21:28:53 +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) => {
|
form.addEventListener("reset", async (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
const ok = confirm(
|
||||||
|
"Sicher, dass du alle Einstellungen zurücksetzen möchtest?"
|
||||||
|
);
|
||||||
|
if (ok) {
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
async function reset() {
|
||||||
try {
|
try {
|
||||||
const res = await fetch("/reset", {
|
const res = await fetch("/reset", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
@ -18,4 +27,4 @@ form.addEventListener("reset", async (event) => {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error.message);
|
console.error(error.message);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue