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) { if (!rate) {
rate = "5"; rate = "5";
localStorage.setItem("sync-rate", "5") localStorage.setItem("sync-rate", "5");
} }
if (scheme === "always") { if (scheme === "always") {
@ -36,17 +36,17 @@ export async function setupClientSync (callback) {
socket.send(`rate ${rate}`); socket.send(`rate ${rate}`);
}); });
socket.addEventListener("message", (event) => { socket.addEventListener("message", (event) => {
let message = event.data.toString(); const message = event.data.toString();
if (message === "sync") { if (message === "sync") {
callback(); callback();
} }
else { else {
console.error("clientsync: recieved unexpected message from server, closing socket.") console.error("clientsync: recieved unexpected message from server, closing socket.");
socket.close(); socket.close();
} }
}); });
} }
else { 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 { requestPVE, requestAPI, goToPage, goToURL, instancesConfig, nodesConfig, setTitleAndHeader } from "./utils.js";
import { alert, dialog } from "./dialog.js"; import { alert, dialog } from "./dialog.js";
import { PVE } from "../vars.js"; import { PVE } from "../vars.js";
import { setupClientSync } from "./clientsync.js" import { setupClientSync } from "./clientsync.js";
window.addEventListener("DOMContentLoaded", init); window.addEventListener("DOMContentLoaded", init);

View File

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