fix basepath
This commit is contained in:
parent
14be1eed8d
commit
6d6add4bea
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue