fix power management request

This commit is contained in:
Arthur Lu 2022-12-15 23:08:56 -08:00
parent 07b17cf12c
commit 2c7121d84a

View File

@ -60,7 +60,7 @@ class Instance extends HTMLElement {
powerButton.src = data.status === "running" ? "images/actions/stop.svg" : "images/actions/start.svg"; powerButton.src = data.status === "running" ? "images/actions/stop.svg" : "images/actions/start.svg";
powerButton.addEventListener("click", () => { powerButton.addEventListener("click", () => {
let targetState = this.status == "running" ? "shutdown" : "start"; let targetState = this.status == "running" ? "shutdown" : "start";
let data = request(`/nodes/${this.node}/${this.type}/${this.vmid}/status/${targetState}`); let data = request(`/nodes/${this.node}/${this.type}/${this.vmid}/status/${targetState}`, "POST", {node: this.node, vmid: this.vmid});
console.log(data); console.log(data);
this.status = this.status === "running" ? "stopped" : "running"; this.status = this.status === "running" ? "stopped" : "running";
}); });