Skip to content

Commit

Permalink
fix recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed Mar 6, 2024
1 parent 3ec2092 commit 61fc4da
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/runtime/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default defineNuxtPlugin({
if (to.path === '/') {
const cookieLocale = useCookie('i18n_redirected').value

if (cookieLocale) {
if (cookieLocale && options.locales.includes(cookieLocale) && cookieLocale !== options.defaultLocale) {
return navigateTo(`/${cookieLocale}`)
}

Expand All @@ -33,7 +33,7 @@ export default defineNuxtPlugin({
.map((l) => clean(l.split(';')[0]))
.filter((l) => options.locales.includes(l))[0]

if (headerLocale) {
if (headerLocale && cookieLocale !== options.defaultLocale) {
return navigateTo(`/${headerLocale}`)
}

Expand All @@ -47,7 +47,7 @@ export default defineNuxtPlugin({
: '')
: ''

if (browserLocale) {
if (browserLocale && cookieLocale !== options.defaultLocale) {
return navigateTo(`/${browserLocale}`)
}
}
Expand Down

0 comments on commit 61fc4da

Please sign in to comment.