I'm using nuxt-i18n and @nuxtjs/auth and I want to config the auth.redirect
option to support i18n like this:
// nuxt.config.js
export default {
modules: [
'@nuxtjs/auth',
'nuxt-i18n',
// ...
],
auth: {
redirect: {
home: localePath('/dashboard'),
// ...
},
},
// ...
};
Normally, just like this.$store
, I can access that localePath
function provided by nuxt-i18n through app instance or the context
like this.$localePath
or app.localePath
. But how can use it inside the nuxt.config.js
file?
This option lets you configure various settings for the build step, including loaders , filenames , the webpack config and transpilation .
The Nuxt context is an additional collection of data about the current request to the application that is available in Nuxt Lifecycle Hooks. This object is available to some Nuxt functions like asyncData and nuxtServerInit .
Nuxt provides a runtime config API to expose configuration within your application and server routes, with the ability to update it at runtime by setting environment variables.
Nuxt lets you customize the webpack configuration for building your web application as you want.
In case of @nuxt/auth module with i18n redirection support problem, I've found a workaround: https://github.com/nuxt-community/auth-module/issues/1116#issuecomment-824814739.
Credit @azrikahar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With