fix: fetch tokenParsed

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-02-26 17:04:10 +07:00
parent 7004fcac1d
commit f7dede6efd
5 changed files with 13 additions and 52 deletions

View file

@ -464,9 +464,9 @@ function checkhideBtnAction(keycloakID: string) {
* งขอมลรายชอผใชงาน
*/
onMounted(async () => {
await fetchOrganizationActive();
const token = await tokenParsed();
tokenParsedData.value = token.role || [];
await fetchOrganizationActive();
});
</script>

View file

@ -295,45 +295,6 @@ async function fetchDataTree(id: string) {
const isSuperAdmin = tokenParsedData.value.includes("SUPER_ADMIN");
if (!isSuperAdmin) {
nodes.value = [];
} else {
nodes.value = [
{
labelName: "หน่วยงานทั้งหมด",
orgCode: "",
orgLevel: 0,
orgName: "",
orgRevisionId: "",
orgRootName: "",
orgTreeCode: "",
orgTreeFax: "",
orgTreeId: "",
orgTreeName: "หน่วยงานทั้งหมด",
orgTreeOrder: 0,
orgTreePhoneEx: "",
orgTreePhoneIn: "",
orgTreeRank: "",
orgTreeRankSub: "",
orgTreeShortName: "",
responsibility: "",
totalPosition: 0,
totalPositionCurrentUse: 0,
totalPositionCurrentVacant: 0,
totalPositionNextUse: 0,
totalPositionNextVacant: 0,
totalRootPosition: 0,
totalRootPositionCurrentUse: 0,
totalRootPositionCurrentVacant: 0,
totalRootPositionNextUse: 0,
totalRootPositionNextVacant: 0,
children: [] as NodeTree[],
isOfficer: false,
orgRootDnaId: "",
orgChild1DnaId: "",
orgChild2DnaId: "",
orgChild3DnaId: "",
orgChild4DnaId: "",
},
];
}
showLoader();
await http
@ -361,7 +322,7 @@ async function fetchDataTree(id: string) {
async function fetchDataTable(
id: string | null,
revisionId: string,
level: number
level: number,
) {
showLoader();
reqMaster.id = id === "" ? null : id;
@ -437,7 +398,7 @@ function onDeleteRole(id: string) {
await fetchDataTable(
reqMaster.id,
reqMaster.revisionId,
reqMaster.type
reqMaster.type,
);
success($q, "ลบข้อมูลสำเร็จ");
})
@ -449,7 +410,7 @@ function onDeleteRole(id: string) {
});
},
"ยืนยันการลบสิทธิ์",
"ต้องการยืนยันการลบสิทธิ์นี้หรือไม่ ?"
"ต้องการยืนยันการลบสิทธิ์นี้หรือไม่ ?",
);
}
@ -482,7 +443,7 @@ watch(
reqMaster.revisionId = "";
filter.value = "";
await fetchDataTree(id);
}
},
);
/** callblck function ทำการ fetch ข้อมูล Table เมื่อมีการเปลี่ยนหน้า*/
@ -513,9 +474,9 @@ function checkhideBtnAction(current_holderId: string) {
}
onMounted(async () => {
fetchOrganizationActive();
const token = await tokenParsed();
tokenParsedData.value = token.role || [];
await fetchOrganizationActive();
});
</script>
@ -688,7 +649,7 @@ onMounted(async () => {
fetchDataTable(
reqMaster.id,
reqMaster.revisionId,
reqMaster.type
reqMaster.type,
)
"
>
@ -775,7 +736,7 @@ onMounted(async () => {
onOpenModalPersonal(
store.typeOrganizational === 'draft'
? props.row.profileIdNextHolder
: props.row.profileIdCurrentHolder
: props.row.profileIdCurrentHolder,
)
"
>
@ -935,7 +896,7 @@ onMounted(async () => {
fetchDataTable(
reqMaster.id,
reqMaster.revisionId,
reqMaster.type
reqMaster.type,
)
"
></q-pagination>

View file

@ -235,14 +235,14 @@ watch(
() => qureyBody.pageSize,
() => {
fetchListPerson(true);
}
},
);
/** hook ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(async () => {
await fetchOrg(); //
const token = await tokenParsed();
tokenParsedData.value = token?.role || [];
await fetchOrg(); //
});
</script>

View file

@ -437,9 +437,9 @@ watch(
);
onMounted(async () => {
fetchOrganizationActive();
const token = await tokenParsed();
tokenParsedData.value = token?.role || [];
await fetchOrganizationActive();
});
</script>

View file

@ -288,9 +288,9 @@ watch(
/** hook ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(async () => {
await fatchOrg(); //
const token = await tokenParsed();
tokenParsedData.value = token?.role || [];
await fatchOrg(); //
});
</script>