2024-04-15 19:39:03 +02:00
|
|
|
export default defineNuxtRouteMiddleware((to) => {
|
2024-03-28 17:59:41 +01:00
|
|
|
if (import.meta.client) return
|
2024-01-14 19:28:39 +01:00
|
|
|
|
|
|
|
|
const config = useRuntimeConfig()
|
2024-04-15 19:39:03 +02:00
|
|
|
if (to.fullPath.startsWith("/api")) {
|
|
|
|
|
const path = to.fullPath.replace("/api", "")
|
|
|
|
|
return navigateTo(config.public.apiBase + path, {
|
|
|
|
|
redirectCode: 301,
|
|
|
|
|
external: true,
|
|
|
|
|
})
|
2024-01-14 19:28:39 +01:00
|
|
|
}
|
|
|
|
|
})
|