Files
openrouter/src/web/js/reboot.js
T
wt ec54166f8f
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Has been cancelled
bootstrap frontend
2025-04-23 17:54:48 +07:00

27 lines
625 B
JavaScript

const rebootbutton = document.querySelector('#rebootbutton')
rebootbutton.addEventListener('click', () => {
if (confirm("Confirm reboot?")) {
reboot()
}
})
const reboot = () => {
loader.classList.add('active')
fetch(routes.reboot(), {
method: 'POST',
body: `{"token":"${localStorage.getItem("token")}"}`
}).then(data => data.json()).then(jsondata => {
}).catch((error) => {
setTimeout(waitreboot, 2000)
})
}
const waitreboot = () => {
fetch(routes.uptime()).then(res => res.json()).then(jsondata => {
}).catch((error) => {
waitreboot()
})
}