diff --git a/api/app/static/js/shared.js b/api/app/static/js/shared.js index b5206db..2078d7b 100644 --- a/api/app/static/js/shared.js +++ b/api/app/static/js/shared.js @@ -1,5 +1,16 @@ // shared.js - Unified utilities for all pages +// ── Root path patch — prepend ROOT_PATH to all relative fetch calls ─────── +(function() { + const _fetch = window.fetch.bind(window); + window.fetch = function(url, ...args) { + if (typeof url === 'string' && url.startsWith('/') && window.ROOT_PATH) { + url = window.ROOT_PATH + url; + } + return _fetch(url, ...args); + }; +})(); + // ── HTML escaping ───────────────────────────────── function esc(s) { if (s == null) return ''; diff --git a/api/app/templates/base.html b/api/app/templates/base.html index 9f4a29e..cbc2e65 100644 --- a/api/app/templates/base.html +++ b/api/app/templates/base.html @@ -27,8 +27,9 @@ {% block content %}{% endblock %} + - + {% block scripts %}{% endblock %}