diff --git a/app/web/src/render/site/site-loader.tsx b/app/web/src/render/site/site-loader.tsx index dddf065d..a2456d93 100644 --- a/app/web/src/render/site/site-loader.tsx +++ b/app/web/src/render/site/site-loader.tsx @@ -16,6 +16,7 @@ export const siteLoader: Loader = { cache.pages = res.pages; cache.api = res.api; + if (typeof w.basepath === "undefined") w.basepath = ""; w.serverurl = res.site.config.api_url; w.apiurl = res.site.config.api_url; @@ -48,7 +49,7 @@ export const siteLoader: Loader = { }; const load = async (url: string) => { - const res = await fetch(`${base}${url}`); + const res = await fetch(`${w.basepath}${base}${url}`); const text = await res.text(); const json = JSON.parse(text); return json; diff --git a/app/web/src/utils/script/init-api.ts b/app/web/src/utils/script/init-api.ts index ecd871db..e0bfff21 100644 --- a/app/web/src/utils/script/init-api.ts +++ b/app/web/src/utils/script/init-api.ts @@ -9,6 +9,7 @@ export const w = window as unknown as { dbClient: typeof dbClient; serverurl: string; apiurl: string; + basepath: string; }; export const createAPI = (url: string) => {