fix handleResponse responding with proxmox task status

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2023-06-03 00:10:33 +00:00
parent 4f654f5dcf
commit 3f98355d32

2
pve.js
View File

@ -35,7 +35,7 @@ export async function requestPVE(path, method, cookies, body = null, token = nul
export async function handleResponse(node, result, res) { export async function handleResponse(node, result, res) {
const waitFor = delay => new Promise(resolve => setTimeout(resolve, delay)); const waitFor = delay => new Promise(resolve => setTimeout(resolve, delay));
if (result.data.data && typeof(result.data.data) === String && result.data.data.startsWith("UPID:")) { if (result.data.data && typeof(result.data.data) === "string" && result.data.data.startsWith("UPID:")) {
let upid = result.data.data; let upid = result.data.data;
while (true) { while (true) {
let taskStatus = await requestPVE(`/nodes/${node}/tasks/${upid}/status`, "GET", null, null, pveAPIToken); let taskStatus = await requestPVE(`/nodes/${node}/tasks/${upid}/status`, "GET", null, null, pveAPIToken);