fixing error R function

This commit is contained in:
Warunee Tamkoo 2024-07-08 21:27:17 +07:00
parent 73f6d9c6f7
commit afe7fbf3dd

View file

@ -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
});
</script>
<template>
<div class="row q-gutter-sm items-center">
<div class="toptitle col text-right q-gutter-x-sm">
@ -449,7 +450,7 @@ onMounted(async () => {
}}
</div>
<div class="q-py-xs">
{{ date2Thai(informaData.birthDate) }}
{{ informaData.birthDate ? date2Thai(informaData.birthDate) : "" }}
</div>
<div class="q-py-xs">
{{ age ? age : "-" }}