fix bug: "ADMIN" only disable action
This commit is contained in:
parent
3856035ce1
commit
d4b61dd490
7 changed files with 75 additions and 23 deletions
|
|
@ -63,9 +63,8 @@ const personId = ref<string>("");
|
|||
* ฟังก์ชันดึงข้อมูลโครงสร้าง
|
||||
* เก็บข้อมูลโครงสร้างไว้ใน nodeTree
|
||||
*/
|
||||
async function fatchOrg() {
|
||||
const tokenParsedData = await tokenParsed();
|
||||
const isSuperAdmin = tokenParsedData.role.includes("SUPER_ADMIN");
|
||||
async function fetchOrg() {
|
||||
const isSuperAdmin = tokenParsedData.value.includes("SUPER_ADMIN");
|
||||
if (!isSuperAdmin) {
|
||||
nodeTree.value = [];
|
||||
}
|
||||
|
|
@ -215,8 +214,13 @@ function updatemodalPersonal(modal: boolean) {
|
|||
modalPersonal.value = modal;
|
||||
}
|
||||
|
||||
const tokenParsedData = ref<string[]>([]);
|
||||
function checkhideBtnAction(id: string) {
|
||||
if (dataPosition.value?.profileId === id) {
|
||||
if (
|
||||
dataPosition.value?.profileId === id &&
|
||||
tokenParsedData.value.includes("ADMIN") &&
|
||||
!tokenParsedData.value.includes("SUPER_ADMIN")
|
||||
) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
|
@ -236,7 +240,9 @@ watch(
|
|||
|
||||
/** hook ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
|
||||
onMounted(async () => {
|
||||
await fatchOrg(); // ดึงข้อมูลโครงสร้าง
|
||||
await fetchOrg(); // ดึงข้อมูลโครงสร้าง
|
||||
const token = await tokenParsed();
|
||||
tokenParsedData.value = token?.role || [];
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue