Simplify Base URL

This commit is contained in:
Andreas Dinauer 2026-04-06 12:46:28 +02:00
parent 82a3a8f6da
commit c117268d07
3 changed files with 26 additions and 1 deletions

View File

@ -7,6 +7,7 @@
<NuxtLink class="link left-center" :class="{ active: useRoute().fullPath.startsWith('/artifacts') }" to="/artifacts"><UiIcon>box</UiIcon>Artifacts</NuxtLink> <NuxtLink class="link left-center" :class="{ active: useRoute().fullPath.startsWith('/artifacts') }" to="/artifacts"><UiIcon>box</UiIcon>Artifacts</NuxtLink>
</div> </div>
<NuxtLink class="link left-center" :class="{ active: useRoute().fullPath.startsWith('/settings') }" to="/settings"><UiIcon>settings</UiIcon>Settings</NuxtLink> <NuxtLink class="link left-center" :class="{ active: useRoute().fullPath.startsWith('/settings') }" to="/settings"><UiIcon>settings</UiIcon>Settings</NuxtLink>
<a class="link left-center" href="/proxy/auth/logout"><UiIcon>logout</UiIcon> Log Out</a>
</div> </div>
<NuxtPage></NuxtPage> <NuxtPage></NuxtPage>
</div> </div>

View File

@ -4,7 +4,7 @@ export class MavenApi
{ {
static create() static create()
{ {
return build("/proxy/api"); return build("/api");
} }
} }

View File

@ -0,0 +1,24 @@
import type {H3Event} from "h3";
export default defineEventHandler(async (event) =>
{
event.headers.delete("host");
event.headers.delete("origin");
return sendProxy(event, process.env.NUXT_PUBLIC_BASE_URL + event.path, {
fetchOptions: {
method: event.method,
headers: event.headers,
body: await readBody(event)
}
});
})
async function readBody(event: H3Event)
{
if (["POST", "PUT", "PATCH"].includes(event.method))
{
return await readRawBody(event);
}
return undefined;
}