asd
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user