fix linting errors

This commit is contained in:
Arthur Lu 2023-07-28 18:32:04 +00:00
parent ddfca3b5ef
commit 482d2a512a
4 changed files with 12 additions and 12 deletions

View File

@ -10,7 +10,7 @@ export async function setupClientSync (callback) {
}
if (!rate) {
rate = "5";
localStorage.setItem("sync-rate", "5")
localStorage.setItem("sync-rate", "5");
}
if (scheme === "always") {
@ -36,17 +36,17 @@ export async function setupClientSync (callback) {
socket.send(`rate ${rate}`);
});
socket.addEventListener("message", (event) => {
let message = event.data.toString();
const message = event.data.toString();
if (message === "sync") {
callback();
}
else {
console.error("clientsync: recieved unexpected message from server, closing socket.")
console.error("clientsync: recieved unexpected message from server, closing socket.");
socket.close();
}
});
}
else {
console.error(`clientsync: unsupported scheme ${scheme} selected.`)
console.error(`clientsync: unsupported scheme ${scheme} selected.`);
}
}

View File

@ -1,7 +1,7 @@
import { requestPVE, requestAPI, goToPage, goToURL, instancesConfig, nodesConfig, setTitleAndHeader } from "./utils.js";
import { alert, dialog } from "./dialog.js";
import { PVE } from "../vars.js";
import { setupClientSync } from "./clientsync.js"
import { setupClientSync } from "./clientsync.js";
window.addEventListener("DOMContentLoaded", init);

View File

@ -1,13 +1,13 @@
window.addEventListener("DOMContentLoaded", init);
function init () {
let scheme = localStorage.getItem("sync-scheme");
const scheme = localStorage.getItem("sync-scheme");
if (scheme) {
document.querySelector(`#sync-${scheme}`).checked = true;
}
let rate = localStorage.getItem("sync-rate");
const rate = localStorage.getItem("sync-rate");
if (rate) {
document.querySelector(`#sync-rate`).value = rate;
document.querySelector("#sync-rate").value = rate;
}
document.querySelector("#settings").addEventListener("submit", handleSaveSettings, false);
}
@ -15,7 +15,7 @@ function init () {
function handleSaveSettings (event) {
event.preventDefault();
const form = new FormData(document.querySelector("#settings"));
console.log(form.get("sync-scheme"))
console.log(form.get("sync-scheme"));
localStorage.setItem("sync-scheme", form.get("sync-scheme"));
localStorage.setItem("sync-rate", form.get("sync-rate"));
window.location.reload();