fix: path changes
Some checks are pending
Build and Push / build (push) Waiting to run

This commit is contained in:
Bastian Gruber 2026-02-23 15:01:04 -04:00
parent 34a9c068c5
commit 8bc15951e4
No known key found for this signature in database
GPG key ID: 2E8AA0462DB41CBE

View file

@ -587,11 +587,14 @@ function fmtKcal(n) {
return n.toLocaleString(); return n.toLocaleString();
} }
// Base path detection (works under /caltrack/ or /)
const basePath = window.location.pathname.replace(/\/$/, '');
// Fetch helpers // Fetch helpers
async function api(method, path, body) { async function api(method, path, body) {
const opts = { method, headers: { 'Content-Type': 'application/json' } }; const opts = { method, headers: { 'Content-Type': 'application/json' } };
if (body) opts.body = JSON.stringify(body); if (body) opts.body = JSON.stringify(body);
const res = await fetch(path, opts); const res = await fetch(basePath + path, opts);
return res.json(); return res.json();
} }