Skip to content

Commit

Permalink
refactor: 🎨 Don't fetch from config, use runtimeConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
CPlusPatch committed Apr 15, 2024
1 parent a7dbb2a commit 7accd4c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions composables/useConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
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")) {
// On server, this will be some kind of localhost
Expand All @@ -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(),
);
); */
};

0 comments on commit 7accd4c

Please sign in to comment.