fixing
This commit is contained in:
parent
73d45a3d24
commit
0e87c63641
123 changed files with 310 additions and 10280 deletions
19
src/utils/permissions.ts
Normal file
19
src/utils/permissions.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Function สำหรับเช็ค permission ของ user
|
||||
*/
|
||||
import { useMenuDataStore } from "@/stores/menuList";
|
||||
import type { RoleData } from "@/interface/main";
|
||||
|
||||
const storeMenu = useMenuDataStore();
|
||||
|
||||
export function checkPermission(route: any): RoleData | null {
|
||||
if (storeMenu.permissions && route.meta.Key) {
|
||||
const role =
|
||||
storeMenu.permissions.roles.find((item) =>
|
||||
item.authSysId.includes(route.meta.Key)
|
||||
) ?? null;
|
||||
return role;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue