Skip to content

Commit

Permalink
Revert "fix: check if route is defined by i18n before redirect (#1902)…
Browse files Browse the repository at this point in the history
…" (#2153)

This reverts commit 182098b.
  • Loading branch information
kazupon committed Jun 13, 2023
1 parent 1b74b01 commit 9b54123
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/runtime/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,6 @@ export function detectRedirect<Context extends NuxtApp = NuxtApp>(
let redirectPath = ''
const isStaticGenerate = isSSG && process.server

if (!isI18nRouteDefined(route)) {
return redirectPath
}

// decide whether we should redirect to a different route.
if (
!isStaticGenerate &&
Expand Down Expand Up @@ -511,9 +507,5 @@ export function extendBaseUrl<Context extends NuxtApp = NuxtApp>(
return baseUrl
}
}
function isI18nRouteDefined(route: Route | RouteLocationNormalized | RouteLocationNormalizedLoaded): boolean {
const i18nLocales = route.matched[0]?.meta.nuxtI18n
return i18nLocales ? Object.keys(i18nLocales).length > 0 : false
}

/* eslint-enable @typescript-eslint/no-explicit-any */

0 comments on commit 9b54123

Please sign in to comment.