Replies: 2 comments
-
I had the same idea, but the answer I got so far is no , But there are corresponding methods to achieve the same function, such as |
Beta Was this translation helpful? Give feedback.
0 replies
-
vite-plugin-pages is not an ssr framework, so it cannot act exactly like nuxt.js (serving as server side api routes) You can however define router.beforeEach((to, from, next) => {
if (!to.fullPath.startsWith('/admin')) return next()
const me = getMe()
if (me.hasPermission(Permission.ADMIN)) return next()
next('/')
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is it possible to create src/middleware/guest.js, src/middleware/auth.js, src/middleware.role.js... and define the middleware in pages ?
For example, is a page exists like: src/pages/student/somepage.vue then this page should be accessible only by an authenticated user and the role of the user should be
student
.Beta Was this translation helpful? Give feedback.
All reactions