How to restrict access to the ranting and vue from the server (middleware)?

A question - how to limit to some ranting and user access, like it is done in express? For example we have a page, which will display only if the server we will allow (i.e., when the transition - send the request if the server answers "Yes" then proceed.
My ranting is described as:
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;

And we need to make two different checks - while trying to go to /edms/admin' - make 1 request to the server when switching to /edms/superAdmin or two.
Can it be done?
June 8th 19 at 16:37
1 answer
June 8th 19 at 16:39
make beforeeach
if route = = "admin", then make a request to the server for resolution

Find more questions by tags Vue.js