Admin pages: use inherited base_url from render_template

This commit is contained in:
Simon Li
2024-08-13 16:33:16 +01:00
parent a377f8bc7f
commit e63ec9aedc
2 changed files with 1 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ const base_url = jhdata.base_url || "/";
const xsrfToken = jhdata.xsrf_token;
export const jhapiRequest = (endpoint, method, data) => {
let api_url = new URL(`${base_url}hub/api` + endpoint, location.origin);
let api_url = new URL(`${base_url}api` + endpoint, location.origin);
if (xsrfToken) {
api_url.searchParams.set("_xsrf", xsrfToken);
}