ProxmoxAAS-Dashboard/index.js

21 lines
666 B
JavaScript
Raw Normal View History

import {requestTicket, setTicket, request} from "./utils.js";
2022-12-11 02:02:29 +00:00
window.addEventListener("DOMContentLoaded", init);
async function init () {
let cookie = document.cookie;
if (cookie === '') {
2022-12-11 02:02:29 +00:00
let username = prompt("username: ");
let password = prompt("password: ")
let ticket = await requestTicket(username, password);
setTicket(ticket.data.ticket);
}
let nodes = await request("/nodes", "GET", null);
let nodeContainer = document.getElementById("node-container")
for (let i = 0; i < nodes.data.length; i++) {
let newNode = document.createElement("node-card");
newNode.data = nodes.data[i];
nodeContainer.append(newNode);
2022-12-11 02:02:29 +00:00
}
}