make body optional parameter for request function

This commit is contained in:
Arthur Lu 2022-12-12 16:30:55 -08:00
parent 4a97631ec9
commit f681ad77e7
2 changed files with 3 additions and 3 deletions

View File

@ -16,9 +16,9 @@ async function init () {
let newNode = document.createElement("node-article"); let newNode = document.createElement("node-article");
newNode.data = nodes.data[i]; newNode.data = nodes.data[i];
let qemu = await request(`/nodes/${nodes.data[i].node}/qemu`, "GET", null); let qemu = await request(`/nodes/${nodes.data[i].node}/qemu`, "GET");
qemu.data.sort((a, b) => (a.vmid > b.vmid) ? 1 : -1); qemu.data.sort((a, b) => (a.vmid > b.vmid) ? 1 : -1);
let lxc = await request(`/nodes/${nodes.data[i].node}/lxc`, "GET", null); let lxc = await request(`/nodes/${nodes.data[i].node}/lxc`, "GET");
lxc.data.sort((a, b) => (a.vmid > b.vmid) ? 1 : -1); lxc.data.sort((a, b) => (a.vmid > b.vmid) ? 1 : -1);
newNode.qemu = qemu.data; newNode.qemu = qemu.data;
newNode.lxc = lxc.data; newNode.lxc = lxc.data;

View File

@ -24,7 +24,7 @@ export function setTicket (ticket) {
document.cookie = `PVEAuthCookie=${ticket}; path=/; expires=${d.toUTCString()}; domain=.tronnet.net`; document.cookie = `PVEAuthCookie=${ticket}; path=/; expires=${d.toUTCString()}; domain=.tronnet.net`;
} }
export async function request (path, method, body, auth = true) { export async function request (path, method, body = null, auth = true) {
let prms = new URLSearchParams(body); let prms = new URLSearchParams(body);
let content = { let content = {