request help: in /src/views/dashboard/index.vue, when and how the roles was set
Closed this issue · 1 comments
jujiale commented
hello:
I am a novice in vue3, when I learn this project, I suffered a question that I hope be solved by yours
v3-admin-vite/src/views/dashboard/index.vue
Lines 6 to 7 in 4d3d4e1
as above code, when use admin user to login, and login is successful, the userStore.roles.includes("admin") will return true, I want to know how and when, the username "admin", was set into userStore.roles.
I am learning vue3 recently, hope your relpy, thanks
jujiale commented
it seems I have found the roles where it added, in /src/router/permisson.ts, router.beforeEach as a intercepter, so when we visit any page, the router.beforeEach will be executed, it's inner logic added the roles