summaryrefslogtreecommitdiffstats
path: root/app/static/js
diff options
context:
space:
mode:
Diffstat (limited to 'app/static/js')
-rw-r--r--app/static/js/main.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/static/js/main.js b/app/static/js/main.js
new file mode 100644
index 0000000..ed1147b
--- /dev/null
+++ b/app/static/js/main.js
@@ -0,0 +1,18 @@
+// Global JSON fetch helper — redirects to /login on 401
+async function api(url, options = {}) {
+ const res = await fetch(url, {
+ headers: {'Content-Type': 'application/json'},
+ ...options,
+ });
+ if (res.status === 401) {
+ window.location.href = '/login?next=' + encodeURIComponent(window.location.pathname);
+ return null;
+ }
+ return res;
+}
+
+document.addEventListener('DOMContentLoaded', () => {
+ document.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(el =>
+ new bootstrap.Tooltip(el)
+ );
+});