fix(js): patch fetch to prepend ROOT_PATH for IIS reverse proxy
All relative /api/... calls automatically get /gomag prefix via global fetch wrapper in shared.js. ROOT_PATH injected from template. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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 '';
|
||||
|
||||
Reference in New Issue
Block a user