fix goToPage

This commit is contained in:
Arthur Lu 2022-12-18 21:58:46 -08:00
parent 5dc35cbbf3
commit 73ab09983c
4 changed files with 4 additions and 4 deletions

View File

@ -125,7 +125,7 @@ class Instance extends HTMLElement {
configButton.src = data.status === "running" ? "images/actions/config-inactive.svg" : "images/actions/config-active.svg";
configButton.addEventListener("click", () => {
if (!this.actionLock && this.status !== "running") {
goToPage("https://client.tronnet.net/config.html", {type: this.type, vmid: this.vmid});
goToPage("config.html", {type: this.type, vmid: this.vmid});
}
})
}

View File

@ -9,7 +9,7 @@ async function init () {
async function populateInstances () {
let cookie = document.cookie;
if (cookie === "") {
goToPage("https://client.tronnet.net/login.html");
goToPage("login.html");
}
let nodes = await request("/nodes", "GET", null);

View File

@ -14,7 +14,7 @@ function init (){
status.innerText = "Authenticating...";
let ticket = await requestTicket(formData.get("username"), formData.get("password"));
setTicket(ticket.data.ticket, ticket.data.CSRFPreventionToken);
goToPage("https://client.tronnet.net/index.html");
goToPage("index.html");
}
catch (error) {
if(error instanceof ResponseError) { // response error is usually 401 auth failed

View File

@ -79,7 +79,7 @@ export async function request (path, method, body = null, auth = true) {
}
export function goToPage (page, data={}) {
let url = new URL(url);
let url = new URL(`https://client.tronnet.net/${page}`);
for(let k in data) {
url.searchParams.append(k, data[k]);
}