This commit is contained in:
2025-12-08 03:03:41 +01:00
parent 3b00372240
commit c6ea2f14a6
4 changed files with 16 additions and 1 deletions

View File

@@ -4,6 +4,10 @@ const API =
(window.APP_API_BASE && window.APP_API_BASE.replace(/\/$/, '')) ||
(BASE ? `${BASE}/api.php` : 'api.php');
const searchParams = new URLSearchParams(window.location.search || '');
const disableAuthRedirect =
Boolean(window.DISABLE_AUTH_REDIRECT) || searchParams.has('debug_redirect');
/** ---- intern: Hilfen ---- */
function withTs(url) {
const sep = url.includes("?") ? "&" : "?";
@@ -30,7 +34,9 @@ async function apiFetch(url, init = {}) {
...init,
});
if (res.status === 401) {
window.location.href = "/login.php";
if (!disableAuthRedirect) {
window.location.href = "/login.php";
}
throw new Error("unauthorized");
}
return res;