routing inside url
This commit is contained in:
parent
2d0fb30558
commit
6247c385c3
15 changed files with 278 additions and 203 deletions
24
src/router/adminGuard.ts
Normal file
24
src/router/adminGuard.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import NProgress from "nprogress";
|
||||
import { useAbilityStore } from "../stores/ability";
|
||||
import { useNavigationStore } from "../stores/admin/navigation";
|
||||
|
||||
export async function abilityAndNavUpdate(to: any, from: any, next: any) {
|
||||
NProgress.start();
|
||||
const ability = useAbilityStore();
|
||||
const navigation = useNavigationStore();
|
||||
|
||||
let type = to.meta.type;
|
||||
let section = to.meta.section;
|
||||
let module = to.meta.module;
|
||||
|
||||
navigation.activeNavigation = to.name.split("-")[1];
|
||||
navigation.activeLink = to.name.split("-")[2];
|
||||
|
||||
if (ability.can(type, section, module)) {
|
||||
NProgress.done();
|
||||
next();
|
||||
} else {
|
||||
NProgress.done();
|
||||
next(false);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue