fix: exclude api routes from locale redirect

This commit is contained in:
2026-01-13 15:11:47 +01:00
parent 352212c0e0
commit bf2d939efe

View File

@@ -14,7 +14,7 @@ export function middleware(request: NextRequest) {
if (pathnameHasLocale) return; if (pathnameHasLocale) return;
if (pathname.includes("sw.js") || pathname.includes("workbox")) return NextResponse.next(); if (pathname.startsWith("/api") || pathname.includes("sw.js") || pathname.includes("workbox")) return NextResponse.next();
// Redirect if there is no locale // Redirect if there is no locale
const locale = defaultLocale; // For simplicity, we default to 'de' as requested const locale = defaultLocale; // For simplicity, we default to 'de' as requested