implement partial SSR of instances

This commit is contained in:
2025-03-12 20:16:51 +00:00
parent 8b508d14cc
commit 59d12d2e99
15 changed files with 611 additions and 264 deletions

View File

@@ -247,6 +247,21 @@ export async function requestAPI (path, method, body = null) {
return response;
}
export async function getInstancesFragment () {
const content = {
method: "GET",
mode: "cors",
credentials: "include",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
}
};
content.headers.CSRFPreventionToken = getCookie("CSRFPreventionToken");
const response = await request(`${window.DASH}/instances_fragment`, content);
return response;
}
async function request (url, content) {
try {
const response = await fetch(url, content);
@@ -260,6 +275,10 @@ async function request (url, content) {
data = { data: await response.text() };
data.status = response.status;
}
else if (contentType.includes("text/plain")) {
data = { data: await response.text() };
data.status = response.status;
}
else {
data = response;
}