mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-02 18:37:21 +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)
|
|
}
|