fix cookie check logic
This commit is contained in:
parent
8f37806280
commit
289ca85e81
@ -1,4 +1,4 @@
|
|||||||
import {requestPVE, requestAPI} from "./utils.js";
|
import {requestAPI, goToPage} from "./utils.js";
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", init);
|
window.addEventListener("DOMContentLoaded", init);
|
||||||
|
|
||||||
@ -11,6 +11,11 @@ let SIPrefix = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
async function init () {
|
async function init () {
|
||||||
|
let cookie = document.cookie;
|
||||||
|
if (cookie === "") {
|
||||||
|
goToPage("login.html");
|
||||||
|
}
|
||||||
|
|
||||||
let resources = await requestAPI("/user/resources");
|
let resources = await requestAPI("/user/resources");
|
||||||
buildResourceTable(resources, "#resource-table");
|
buildResourceTable(resources, "#resource-table");
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,11 @@ import {Dialog} from "./dialog.js";
|
|||||||
window.addEventListener("DOMContentLoaded", init);
|
window.addEventListener("DOMContentLoaded", init);
|
||||||
|
|
||||||
async function init () {
|
async function init () {
|
||||||
|
let cookie = document.cookie;
|
||||||
|
if (cookie === "") {
|
||||||
|
goToPage("login.html");
|
||||||
|
}
|
||||||
|
|
||||||
await populateInstances();
|
await populateInstances();
|
||||||
|
|
||||||
let addInstanceBtn = document.querySelector("#instance-add");
|
let addInstanceBtn = document.querySelector("#instance-add");
|
||||||
@ -11,15 +16,8 @@ async function init () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function populateInstances () {
|
async function populateInstances () {
|
||||||
let cookie = document.cookie;
|
|
||||||
if (cookie === "") {
|
|
||||||
goToPage("login.html");
|
|
||||||
}
|
|
||||||
|
|
||||||
let resources = await requestPVE("/cluster/resources", "GET", null);
|
let resources = await requestPVE("/cluster/resources", "GET", null);
|
||||||
|
let instanceContainer = document.getElementById("instance-container");
|
||||||
let instanceContainer = document.getElementById("instance-container")
|
|
||||||
|
|
||||||
let instances = [];
|
let instances = [];
|
||||||
|
|
||||||
resources.data.forEach((element) => {
|
resources.data.forEach((element) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user