Hello,
Am using this project and I found an issue with middleware.
On my app I check for admin by role. In store -> Auth.js
isAdmin: (state) => {
return state.user ? state.user.role === 'admin' : false;
}
I have created and tested with another role manager:
isManager: (state) => {
return state.user ? state.user.role === 'manager' : false;
}
and in the index.js route:
{
path: '/domains',
name: 'domain',
meta: { middleware: [auth, admin, manager]},
component: () => import......
}
Created a middleware manager:
export default function manager({ next, store }) {
if (store.getters["auth/isManager"]) next();
else next({ name: "notFound" });
}
When I login with user role manager the route 'domain' works. If I login with admin it gives 404 (notFound)
It seems like it persist the last middleware (if I am logged is as admin and the last middleware is manager) it gives notFound from manager middleware.
Any idea how can I make it work for both admin and manager ?
Hello,
Am using this project and I found an issue with middleware.
On my app I check for admin by role. In store -> Auth.js
I have created and tested with another role manager:
and in the index.js route:
Created a middleware manager:
When I login with user role manager the route 'domain' works. If I login with admin it gives 404 (notFound)
It seems like it persist the last middleware (if I am logged is as admin and the last middleware is manager) it gives notFound from manager middleware.
Any idea how can I make it work for both admin and manager ?