asd
This commit is contained in:
@@ -16,6 +16,9 @@ $debugRedirect = isset($_GET['debug_redirect']);
|
|||||||
<script>
|
<script>
|
||||||
window.APP_BASE_URL = <?= json_encode($appBaseUrl, JSON_UNESCAPED_SLASHES) ?>;
|
window.APP_BASE_URL = <?= json_encode($appBaseUrl, JSON_UNESCAPED_SLASHES) ?>;
|
||||||
window.APP_API_BASE = <?= json_encode($appApiBase, 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>
|
||||||
<script src="https://cdn.tailwindcss.com"></script>
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
<?php if ($debugRedirect): ?>
|
<?php if ($debugRedirect): ?>
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ $debugRedirect = isset($_GET['debug_redirect']);
|
|||||||
<script>
|
<script>
|
||||||
window.APP_BASE_URL = <?= json_encode($appBaseUrl, JSON_UNESCAPED_SLASHES) ?>;
|
window.APP_BASE_URL = <?= json_encode($appBaseUrl, JSON_UNESCAPED_SLASHES) ?>;
|
||||||
window.APP_API_BASE = <?= json_encode($appApiBase, 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>
|
||||||
<script src="https://cdn.tailwindcss.com"></script>
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
<?php if ($debugRedirect): ?>
|
<?php if ($debugRedirect): ?>
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ $debugRedirect = isset($_GET['debug_redirect']);
|
|||||||
<script>
|
<script>
|
||||||
window.APP_BASE_URL = <?= json_encode($appBaseUrl, JSON_UNESCAPED_SLASHES) ?>;
|
window.APP_BASE_URL = <?= json_encode($appBaseUrl, JSON_UNESCAPED_SLASHES) ?>;
|
||||||
window.APP_API_BASE = <?= json_encode($appApiBase, 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>
|
||||||
<script src="https://cdn.tailwindcss.com"></script>
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
<?php if ($debugRedirect): ?>
|
<?php if ($debugRedirect): ?>
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ const API =
|
|||||||
(window.APP_API_BASE && window.APP_API_BASE.replace(/\/$/, '')) ||
|
(window.APP_API_BASE && window.APP_API_BASE.replace(/\/$/, '')) ||
|
||||||
(BASE ? `${BASE}/api.php` : 'api.php');
|
(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 ---- */
|
/** ---- intern: Hilfen ---- */
|
||||||
function withTs(url) {
|
function withTs(url) {
|
||||||
const sep = url.includes("?") ? "&" : "?";
|
const sep = url.includes("?") ? "&" : "?";
|
||||||
@@ -30,7 +34,9 @@ async function apiFetch(url, init = {}) {
|
|||||||
...init,
|
...init,
|
||||||
});
|
});
|
||||||
if (res.status === 401) {
|
if (res.status === 401) {
|
||||||
|
if (!disableAuthRedirect) {
|
||||||
window.location.href = "/login.php";
|
window.location.href = "/login.php";
|
||||||
|
}
|
||||||
throw new Error("unauthorized");
|
throw new Error("unauthorized");
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
Reference in New Issue
Block a user