Grotti 3.1.0: Bedarf-UI, Zeitfenster, HT/NT, Theme, Chrome-Fixes.
Bedarf in Sidebar/Material, Drucker-Zeitfenster und Tarif in Einstellungen, helles Theme; Legacy-Token und /api/drucker entfernt; SSE/SW-Fixes gegen hängende Navigation in Chrome.
This commit is contained in:
1 parent
8e88efc094
commit
6e59df22e5
23 files changed
+741
-171
No files matched your search
+23
-7
@@ -28,13 +28,29 @@ async function api(path, options = {}) {
|
||||
headers.set("Content-Type", "application/json");
|
||||
body = JSON.stringify(options.json);
|
||||
}
|
||||
const response = await fetch("/api/v1" + path, {
|
||||
method,
|
||||
headers,
|
||||
body,
|
||||
cache: "no-store",
|
||||
credentials: "same-origin",
|
||||
});
|
||||
const timeoutMs = options.timeoutMs != null ? Number(options.timeoutMs) : 20000;
|
||||
const ctrl = options.signal ? null : new AbortController();
|
||||
const timer = ctrl && timeoutMs > 0
|
||||
? setTimeout(() => ctrl.abort(), timeoutMs)
|
||||
: 0;
|
||||
let response;
|
||||
try {
|
||||
response = await fetch("/api/v1" + path, {
|
||||
method,
|
||||
headers,
|
||||
body,
|
||||
cache: "no-store",
|
||||
credentials: "same-origin",
|
||||
signal: options.signal || (ctrl && ctrl.signal),
|
||||
});
|
||||
} catch (error) {
|
||||
if (error && error.name === "AbortError") {
|
||||
throw new Error("Zeitüberschreitung — Server antwortet nicht.");
|
||||
}
|
||||
throw error;
|
||||
} finally {
|
||||
if (timer) clearTimeout(timer);
|
||||
}
|
||||
if (response.status === 401) {
|
||||
const here = location.pathname + location.search;
|
||||
if (!here.startsWith("/login") && !here.startsWith("/setup")) {
|
||||
|
||||
Reference in new issue
Block a user