Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae846c9bb8 |
1 changed files with 21 additions and 20 deletions
|
|
@ -178,31 +178,32 @@ const landingPageUrl = ref<string>(configParam.landingPageUrl)
|
||||||
/** ฟังก์ชันเรียกข้อมูลผู้ใช่งาน*/
|
/** ฟังก์ชันเรียกข้อมูลผู้ใช่งาน*/
|
||||||
async function fetchKeycloakPosition() {
|
async function fetchKeycloakPosition() {
|
||||||
// เช็คว่ามีข้อมูลใน store อยู่แล้วหรือไม่ (จาก localStorage)
|
// เช็คว่ามีข้อมูลใน store อยู่แล้วหรือไม่ (จาก localStorage)
|
||||||
const existingData = positionKeycloakStore.dataPositionKeycloak
|
// จะช่วยลดจำนวนครั้งในการเรียก API และปรับปรุงประสิทธิภาพของแอปพลิเคชัน
|
||||||
|
// const existingData = positionKeycloakStore.dataPositionKeycloak
|
||||||
|
|
||||||
if (existingData) {
|
// if (existingData) {
|
||||||
// มีข้อมูลอยู่แล้ว ใช้ข้อมูลเดิม
|
// // มีข้อมูลอยู่แล้ว ใช้ข้อมูลเดิม
|
||||||
|
|
||||||
// เช็คว่ามีข้อมูลสังกัด (organization) หรือไม่
|
// // เช็คว่ามีข้อมูลสังกัด (organization) หรือไม่
|
||||||
const hasOrganization =
|
// const hasOrganization =
|
||||||
existingData.organization &&
|
// existingData.organization &&
|
||||||
(existingData.organization.root ||
|
// (existingData.organization.root ||
|
||||||
existingData.organization.child1 ||
|
// existingData.organization.child1 ||
|
||||||
existingData.organization.child2 ||
|
// existingData.organization.child2 ||
|
||||||
existingData.organization.child3 ||
|
// existingData.organization.child3 ||
|
||||||
existingData.organization.child4)
|
// existingData.organization.child4)
|
||||||
|
|
||||||
if (!hasOrganization) {
|
// if (!hasOrganization) {
|
||||||
// ไม่มีข้อมูลสังกัด redirect ไปหน้า NoPosition
|
// // ไม่มีข้อมูลสังกัด redirect ไปหน้า NoPosition
|
||||||
router.replace('/no-position')
|
// router.replace('/no-position')
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
privacyStore.modalPrivacy = !existingData.privacyCheckin
|
// privacyStore.modalPrivacy = !existingData.privacyCheckin
|
||||||
privacyStore.setAccepted(existingData.privacyCheckin)
|
// privacyStore.setAccepted(existingData.privacyCheckin)
|
||||||
|
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
// ไม่มีข้อมูล ให้ fetch จาก API
|
// ไม่มีข้อมูล ให้ fetch จาก API
|
||||||
await http
|
await http
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue