refactor: 🎨 Don't fetch from config, use runtimeConfig

This commit is contained in:
Jesse Wierzbinski 2024-04-14 16:41:56 -10:00
parent a7dbb2afce
commit 7accd4c037
No known key found for this signature in database

View file

@ -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(),
); ); */
}; };