fix bug: "ADMIN" only disable action
This commit is contained in:
parent
3856035ce1
commit
d4b61dd490
7 changed files with 75 additions and 23 deletions
|
|
@ -273,13 +273,13 @@ async function fetchOrganizationActive() {
|
|||
});
|
||||
}
|
||||
|
||||
const tokenParsedData = ref<string[]>([]);
|
||||
/**
|
||||
* function fetch ข้อมูลของ Tree
|
||||
* @param id id โครงสร้าง
|
||||
*/
|
||||
async function fetchDataTree(id: string) {
|
||||
const tokenParsedData = await tokenParsed();
|
||||
const isSuperAdmin = tokenParsedData.role.includes("SUPER_ADMIN");
|
||||
const isSuperAdmin = tokenParsedData.value.includes("SUPER_ADMIN");
|
||||
if (!isSuperAdmin) {
|
||||
nodes.value = [];
|
||||
}
|
||||
|
|
@ -411,7 +411,11 @@ function updatemodalPersonal(modal: boolean) {
|
|||
}
|
||||
|
||||
function hideBtnAction(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;
|
||||
|
|
@ -432,8 +436,10 @@ watch(
|
|||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
fetchOrganizationActive();
|
||||
const token = await tokenParsed();
|
||||
tokenParsedData.value = token?.role || [];
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue