mirror of
https://github.com/versia-pub/frontend.git
synced 2025-12-06 08:28:20 +01:00
refactor: 🎨 Don't fetch from config, use runtimeConfig
This commit is contained in:
parent
a7dbb2afce
commit
7accd4c037
|
|
@ -1,5 +1,7 @@
|
||||||
export const useConfig = async () => {
|
export const useConfig = async () => {
|
||||||
let host = useRequestHeader("X-Forwarded-Host") ?? useRuntimeConfig().public.apiHost;
|
let host =
|
||||||
|
useRequestHeader("X-Forwarded-Host") ??
|
||||||
|
useRuntimeConfig().public.apiHost;
|
||||||
|
|
||||||
if (!host?.includes("http")) {
|
if (!host?.includes("http")) {
|
||||||
// On server, this will be some kind of localhost
|
// On server, this will be some kind of localhost
|
||||||
|
|
@ -13,7 +15,12 @@ export const useConfig = async () => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return await fetch(new URL("/api/_fe/config", host)).then((res) =>
|
return {
|
||||||
|
http: {
|
||||||
|
url: host,
|
||||||
|
base_url: host,
|
||||||
|
},
|
||||||
|
}; /* await fetch(new URL("/api/_fe/config", host)).then((res) =>
|
||||||
res.json(),
|
res.json(),
|
||||||
);
|
); */
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue