File tree 3 files changed +7
-8
lines changed
3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,10 @@ export default boot(async ({ router, store }) => {
21
21
}
22
22
} ) ;
23
23
router . beforeResolve ( ( to , from , next ) => {
24
- // const module = to.meta.module;
25
- const module = false ;
24
+ const module = to . meta . module ;
25
+ const permission = to . meta . permission ;
26
26
if ( module ) {
27
- if ( app . hasPermission ( module ) ) {
27
+ if ( app . hasModulePermission ( module , permission ) ) {
28
28
next ( ) ;
29
29
} else {
30
30
next ( { name : "Dashboard" } ) ;
Original file line number Diff line number Diff line change 19
19
:to =" { name: item.route, params: item.params }"
20
20
v-ripple
21
21
active-class =" active"
22
- exact
23
22
>
24
23
<q-item-section avatar style =" min-width : auto " class =" q-pr-md" >
25
24
<q-icon :name =" item.icon" size =" 18px" ></q-icon >
Original file line number Diff line number Diff line change @@ -37,15 +37,15 @@ export const useAppStore = defineStore("app", {
37
37
hasModulePermission ( state ) {
38
38
return ( module , permission = false ) => {
39
39
if ( state . user . modules ) {
40
- const _module = state . user . modules . find (
40
+ const userModule = state . user . modules . find (
41
41
( item ) => item . name === module
42
42
) ;
43
- if ( ! permission && _module ) {
43
+ if ( ! permission && userModule ) {
44
44
return true ;
45
45
} else if (
46
46
permission &&
47
- _module &&
48
- _module . permissions . find ( ( item ) => item . action === permission )
47
+ userModule &&
48
+ userModule . permissions . find ( ( item ) => item . action === permission )
49
49
) {
50
50
return true ;
51
51
}
You can’t perform that action at this time.
0 commit comments