refactor: 🎨 Move Lysand-FE into its own repository

This commit is contained in:
Jesse Wierzbinski 2024-04-14 15:16:57 -10:00
commit f6989707f4
No known key found for this signature in database
26 changed files with 1226 additions and 0 deletions

19
composables/useConfig.ts Normal file
View file

@ -0,0 +1,19 @@
export const useConfig = async () => {
let host = useRequestHeader("X-Forwarded-Host") ?? useRuntimeConfig().public.apiHost;
if (!host?.includes("http")) {
// On server, this will be some kind of localhost
host = `http://${host}`;
}
if (!host) {
throw createError({
statusCode: 500,
statusMessage: "No X-Forwarded-Host header found",
});
}
return await fetch(new URL("/api/_fe/config", host)).then((res) =>
res.json(),
);
};