Answer the question
In order to leave comments, you need to log in
How to restrict access to vue routes from server (middleware)?
Hello!
Such a question - how to restrict user access to some routes, like how it is done in express? For example, we have a page that can be accessed only if the server allows us (that is, when we try to navigate, we send a request, if the server answers "yes" - then we go.
My routes are described as follows:
const routes = [
{ path: '/', component: require('../components/mainPage') },
{ path: '/edms', component: require('../components/mainPage') },
{ path: '/edms/addNew', component: require('../components/addNewDocPage') },
{ path: '/edms/404', component: require('../components/404') },
{ path: '/edms/admin', component: require('../components/admin') },
{ path: '/edms/superAdmin', component: require('../components/superAdmin') },
{ path: '/edms/:id', component: require('../components/detailsPage') },
{ path: '*', component: require('../components/404') },
];
export default routes;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question