feat: reading permission from role
This commit is contained in:
parent
14e097bab4
commit
f09e5c8066
2 changed files with 34 additions and 0 deletions
|
|
@ -13,6 +13,8 @@ const route = useRoute();
|
|||
const { toc } = storeToRefs(manualStore);
|
||||
const { loader } = storeToRefs(dataStore);
|
||||
|
||||
const role = ref<string>("user");
|
||||
|
||||
const drawerMini = ref(false);
|
||||
const drawerMain = ref(false);
|
||||
const search = ref("");
|
||||
|
|
@ -39,7 +41,20 @@ const toggleBtnLeft = () => {
|
|||
onMounted(async () => {
|
||||
{
|
||||
const data = await fetch("/toc.json").then((r) => r.json());
|
||||
role.value = route.query.role as string;
|
||||
menuList.value = data;
|
||||
if (role.value !== "admin") {
|
||||
menuList.value = data.filter(
|
||||
(v: any) =>
|
||||
!v.label.includes("คู่มือการตรวจสอบและแก้ไข") &&
|
||||
!v.label.includes("คู่มือการจัดการระบบ")
|
||||
);
|
||||
}
|
||||
if (role.value !== "officer" && role.value !== "admin") {
|
||||
menuList.value = menuList.value.filter(
|
||||
(v: any) => !v.label.includes("คู่มือการใช้งาน (เจ้าหน้าที่)")
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue