✨ Simplify Base URL
This commit is contained in:
parent
82a3a8f6da
commit
c117268d07
@ -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>
|
||||||
|
|||||||
@ -4,7 +4,7 @@ export class MavenApi
|
|||||||
{
|
{
|
||||||
static create()
|
static create()
|
||||||
{
|
{
|
||||||
return build("/proxy/api");
|
return build("/api");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
24
server/routes/api/[...path].ts
Normal file
24
server/routes/api/[...path].ts
Normal 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;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user