asd
This commit is contained in:
@@ -16,6 +16,9 @@ $debugRedirect = isset($_GET['debug_redirect']);
|
||||
<script>
|
||||
window.APP_BASE_URL = <?= json_encode($appBaseUrl, JSON_UNESCAPED_SLASHES) ?>;
|
||||
window.APP_API_BASE = <?= json_encode($appApiBase, JSON_UNESCAPED_SLASHES) ?>;
|
||||
<?php if ($debugRedirect): ?>
|
||||
window.DISABLE_AUTH_REDIRECT = true;
|
||||
<?php endif; ?>
|
||||
</script>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<?php if ($debugRedirect): ?>
|
||||
|
||||
@@ -16,6 +16,9 @@ $debugRedirect = isset($_GET['debug_redirect']);
|
||||
<script>
|
||||
window.APP_BASE_URL = <?= json_encode($appBaseUrl, JSON_UNESCAPED_SLASHES) ?>;
|
||||
window.APP_API_BASE = <?= json_encode($appApiBase, JSON_UNESCAPED_SLASHES) ?>;
|
||||
<?php if ($debugRedirect): ?>
|
||||
window.DISABLE_AUTH_REDIRECT = true;
|
||||
<?php endif; ?>
|
||||
</script>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<?php if ($debugRedirect): ?>
|
||||
|
||||
@@ -16,6 +16,9 @@ $debugRedirect = isset($_GET['debug_redirect']);
|
||||
<script>
|
||||
window.APP_BASE_URL = <?= json_encode($appBaseUrl, JSON_UNESCAPED_SLASHES) ?>;
|
||||
window.APP_API_BASE = <?= json_encode($appApiBase, JSON_UNESCAPED_SLASHES) ?>;
|
||||
<?php if ($debugRedirect): ?>
|
||||
window.DISABLE_AUTH_REDIRECT = true;
|
||||
<?php endif; ?>
|
||||
</script>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<?php if ($debugRedirect): ?>
|
||||
|
||||
@@ -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) {
|
||||
if (!disableAuthRedirect) {
|
||||
window.location.href = "/login.php";
|
||||
}
|
||||
throw new Error("unauthorized");
|
||||
}
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user