mirror of
https://github.com/seriousm4x/UpSnap.git
synced 2026-07-22 13:33:39 -04:00
fix: properly reset nic timer
This commit is contained in:
@@ -63,20 +63,18 @@
|
||||
}
|
||||
|
||||
function countdown() {
|
||||
timeout = 120;
|
||||
clearInterval(interval);
|
||||
const end = Date.parse(device.updated) + 2 * 60 * 1000;
|
||||
interval = setInterval(() => {
|
||||
const left = Math.round((end - Date.now()) / 1000);
|
||||
if (left >= 0) {
|
||||
timeout = left;
|
||||
} else {
|
||||
timeout = Math.round((end - Date.now()) / 1000);
|
||||
if (timeout <= 0 || device.status !== 'pending') {
|
||||
clearInterval(interval);
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function handleClick() {
|
||||
clearInterval(interval);
|
||||
timeout = 120;
|
||||
if (device.status === 'offline') {
|
||||
wake();
|
||||
} else if (device.status === 'online') {
|
||||
|
||||
Reference in New Issue
Block a user