update sync endpoint

This commit is contained in:
Arthur Lu 2023-07-11 22:07:08 +00:00
parent 1dd32eda81
commit 55881bdcc0

View File

@ -14,14 +14,14 @@ async function init () {
goToPage("login.html"); goToPage("login.html");
} }
currentHash = (await requestAPI("/cluster/statushash")).data; currentHash = (await requestAPI("/sync/hash")).data;
await populateInstances(); await populateInstances();
const addInstanceBtn = document.querySelector("#instance-add"); const addInstanceBtn = document.querySelector("#instance-add");
addInstanceBtn.addEventListener("click", handleInstanceAdd); addInstanceBtn.addEventListener("click", handleInstanceAdd);
window.setInterval(async () => { window.setInterval(async () => {
const newHash = (await requestAPI("/cluster/statushash")).data; const newHash = (await requestAPI("/sync/hash")).data;
if (currentHash !== newHash) { if (currentHash !== newHash) {
currentHash = newHash; currentHash = newHash;
populateInstances(); populateInstances();
@ -30,7 +30,7 @@ async function init () {
} }
async function populateInstances () { async function populateInstances () {
const newHash = (await requestAPI("/cluster/statushash")).data; const newHash = (await requestAPI("/sync/hash")).data;
currentHash = newHash; currentHash = newHash;
const resources = await requestPVE("/cluster/resources", "GET"); const resources = await requestPVE("/cluster/resources", "GET");
const instanceContainer = document.getElementById("instance-container"); const instanceContainer = document.getElementById("instance-container");