From 54ecfaf782e7ba4d2033497066d2c590897bb4e3 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Tue, 17 Oct 2023 16:42:33 +0000 Subject: [PATCH] improve account page loading time --- scripts/account.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/account.js b/scripts/account.js index 94abc7f..afe31b5 100644 --- a/scripts/account.js +++ b/scripts/account.js @@ -25,14 +25,22 @@ async function init () { if (cookie === "") { goToPage("login.html"); } - const resources = await requestAPI("/user/dynamic/resources"); - const meta = await requestAPI("/global/config/resources"); - const instances = await requestAPI("/user/config/cluster"); - const nodes = await requestAPI("/user/config/nodes"); + + let resources = requestAPI("/user/dynamic/resources"); + let meta = requestAPI("/global/config/resources"); + let instances = requestAPI("/user/config/cluster"); + let nodes = requestAPI("/user/config/nodes"); + + resources = await resources; + meta = await meta; + instances = await instances; + nodes = await nodes; + document.querySelector("#username").innerText = `Username: ${getCookie("username")}`; document.querySelector("#pool").innerText = `Pool: ${instances.pool}`; document.querySelector("#vmid").innerText = `VMID Range: ${instances.vmid.min} - ${instances.vmid.max}`; document.querySelector("#nodes").innerText = `Nodes: ${nodes.toString()}`; + populateResources("#resource-container", meta, resources); }