You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
834 B
29 lines
834 B
let rbtn = document.getElementById("btn-reset");
|
|
let infoBox = document.getElementById("general-info");
|
|
|
|
rbtn.addEventListener("click", e => {
|
|
e.preventDefault();
|
|
|
|
toggleDisabled(rbtn, "on");
|
|
setInfo(infoBox, "Processing Request...", "purple", "grey1");
|
|
toggleHidden(infoBox, "off");
|
|
|
|
fetch("/database", {
|
|
method: "PATCH"
|
|
}).then(res => {
|
|
if (res.status == 200) {
|
|
setInfo(infoBox, "Success", "green", "grey1");
|
|
setTimeout(() => {
|
|
toggleHidden(infoBox, "on");
|
|
}, 2000);
|
|
} else {
|
|
setInfo(infoBox, "Failure", "red", "grey1");
|
|
toggleHidden(infoBox, "off");
|
|
setTimeout(() => {
|
|
toggleHidden(infoBox, "on");
|
|
}, 2000);
|
|
}
|
|
toggleDisabled(rbtn, "off");
|
|
});
|
|
});
|