Hello I have the following configuration
nuxt.config.js
router: {
middleware: ['auth'],
}
auth: {
redirect: {
login: '/login',
logout: '/login',
home: '/',
},
strategies: {
cookie: {
options: {
httpOnly: true,
path: '/',
},
user: {
property: false,
autoFetch: false,
},
endpoints: {
login: { url: '/api/login', method: 'post' },
logout: { url: '/api/logout', method: 'post' },
},
},
},
},
and I the home component it is not necessary be logged, so I set:
export default {
name: 'IndexComponent',
middleware: 'auth',
auth: false,
}
but when I try to access to a / auth always redirects to /login.
when I do click nothing happens and nothing is displayed in the console.
How can I solve this?
In the documentation, it says
In case of global usage, you can set auth option to false in a specific component and the middleware will ignore that route.
But by "component", they mean a .vue
component.
In our case, since we're using Nuxt it still needs to be a page (hence a route in the /pages/
directory) because this is logical from a router aspect.