From afe7fbf3dd2fcd060194c5acd1950b44f909781a Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Mon, 8 Jul 2024 21:27:17 +0700 Subject: [PATCH] fixing error R function --- .../detail/PersonalInformation/01_Profile.vue | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/modules/04_registryNew/components/detail/PersonalInformation/01_Profile.vue b/src/modules/04_registryNew/components/detail/PersonalInformation/01_Profile.vue index 1ec7c9426..9af581c33 100644 --- a/src/modules/04_registryNew/components/detail/PersonalInformation/01_Profile.vue +++ b/src/modules/04_registryNew/components/detail/PersonalInformation/01_Profile.vue @@ -265,11 +265,14 @@ async function getData() { showLoader(); await http .get(config.API.registryNewByProfileId(profileId.value, empType.value)) - .then((res) => { - informaData.value = res.data.result; + .then(async (res) => { + informaData.value = await res.data.result; if (informaData.value) { id.value = informaData.value.id; - age.value = calculateAge(informaData.value.birthDate); + + if (informaData.value.birthDate) { + age.value = calculateAge(informaData.value.birthDate); + } } }) .catch((e) => { @@ -382,22 +385,20 @@ watch( ); onMounted(async () => { - await getData(); - if ( - store.Ops.prefixOps.length === 0 || - store.Ops.genderOps.length === 0 || - store.Ops.bloodOps.length === 0 || - store.Ops.statusOps.length === 0 || - store.Ops.religionOps.length === 0 - ) { - await fetchPerson(); + if (store.Ops.prefixOps && store.Ops.prefixOps.length === 0) { + fetchPerson(); } - // store.genderOp.length === 0 ? await getGender() : ""; - // store.relationshipOp.length === 0 ? await getRelationship() : ""; - // store.religionOp.length === 0 ? await getReligion() : ""; - // store.bloodGroupOp.length === 0 ? await getBloodGroup() : ""; + + await getData(); + + // store.Ops.prefixOps.length === 0 || + // store.Ops.genderOps.length === 0 || + // store.Ops.bloodOps.length === 0 || + // store.Ops.statusOps.length === 0 || + // store.Ops.religionOps.length === 0 }); +