Skip to content

Commit

Permalink
fix: add defineNuxtRouteMiddleware wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Oct 12, 2022
1 parent aaf302d commit a1cb46b
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 @@ -12,7 +12,7 @@ import {
setLocale,
getLocale
} from 'vue-i18n-routing'
import { defineNuxtPlugin, useRouter, addRouteMiddleware } from '#imports'
import { defineNuxtPlugin, useRouter, addRouteMiddleware, defineNuxtRouteMiddleware } from '#imports'
import { localeCodes, resolveNuxtI18nOptions, nuxtI18nInternalOptions } from '#build/i18n.options.mjs'
import {
loadInitialMessages,
Expand Down Expand Up @@ -330,7 +330,7 @@ export default defineNuxtPlugin(async nuxt => {
addRouteMiddleware(
'locale-changing',
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async (to: RouteLocationNormalized, from: RouteLocationNormalized) => {
defineNuxtRouteMiddleware(async (to, from) => {
__DEBUG__ && console.log('locale-changing middleware')

const locale = detectLocale(
Expand Down Expand Up @@ -369,7 +369,7 @@ export default defineNuxtPlugin(async nuxt => {
differentDomains,
skipSettingLocaleOnNavigate
})
},
}),
{ global: true }
)
})
Expand Down

0 comments on commit a1cb46b

Please sign in to comment.