Nuxt how to determine whether the current user has access to the index page, do not answer (such as token,session), do not answer irrelevant questions thank you.

mainly adds permission page control to the backend management system. For example, administrators can access all pages, while junior staff can only access some pages

.

the main problem is how to control the page in the middleware. In the vue set I currently use, I first write a permission.js, using midleware to compare whether the current user has the right to enter the page. If there is no permission, jump to 401. Is there a better way

this is a question of thinking, so I won"t post the code.

get down on your knees and beg your bosses for advice.


I don't know what a better way you're talking about. If you want to capture globally, solve it directly with middleware. If you only want to do this function on a specified page, just do it on the routing hook of that page

.
Menu