mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-13 17:43:59 +00:00
9 lines
307 B
JavaScript
9 lines
307 B
JavaScript
export default async function ({ store, params, error }) {
|
|
const lang = params.lang || 'en'
|
|
if (!store.state.lang.locales.includes(lang)) {
|
|
await store.dispatch('lang/setLang', 'en')
|
|
return error({ message: 'Page not found', statusCode: 404 })
|
|
}
|
|
await store.dispatch('lang/setLang', lang)
|
|
}
|