parent
16fddcc24f
commit
0f6ebe1e58
@ -0,0 +1,28 @@
|
||||
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");
|
||||
});
|
||||
});
|
@ -1,8 +1,11 @@
|
||||
{{define "body"}}
|
||||
<section id="wrapper">
|
||||
<button id="btn-reset">Reset & Refresh Databases</button>
|
||||
<div class="hidden" id="general-info"></div>
|
||||
</section>
|
||||
{{end}}
|
||||
|
||||
{{define "scripts"}}
|
||||
<script src="/static/js/main.js"></script>
|
||||
<script src="/static/js/helper.js"></script>
|
||||
{{end}}
|
Loading…
Reference in new issue