Skip to content

Commit b1e0800

Browse files
committed
fix(frontend): load config.json relative to pages path
1 parent f6a1695 commit b1e0800

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

frontend/js/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function resolveApiBase(runtimeApiBase = '', isLocalPage = ['localhost',
1717

1818
export async function loadRuntimeConfig() {
1919
try {
20-
const res = await fetch('/config.json', { cache: 'no-store' });
20+
const res = await fetch('config.json', { cache: 'no-store' });
2121
if (!res.ok) return { apiBase: '' };
2222
const json = await res.json();
2323
const raw = (json && json.apiBase) ? String(json.apiBase).trim() : '';

frontend/js/tests/main.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ describe('loadRuntimeConfig', () => {
2727
});
2828

2929
await expect(loadRuntimeConfig()).resolves.toEqual({ apiBase: 'https://api.example.com' });
30+
expect(global.fetch).toHaveBeenCalledWith('config.json', { cache: 'no-store' });
3031
});
3132

3233
it('ignores masked or invalid values', async () => {

0 commit comments

Comments
 (0)