fixing await & clear code และเก็บ dataProfile ตอน get profile main layout

This commit is contained in:
Warunee Tamkoo 2025-07-31 09:49:22 +07:00
parent 417a6e5618
commit 1698d86024
3 changed files with 72 additions and 45 deletions

View file

@ -19,35 +19,63 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
const work = ref<boolean>(false);
const tabMain = ref<string>("");
const dataProfile = ref<DataProfile>({
profileId: null,
prefix: "",
rank: "",
firstName: "",
lastName: "",
amountSpecial: 0,
avatar: "",
avatarName: "",
birthDate: "",
child1: "",
child1DnaId: "",
child1Id: "",
child1ShortName: "",
child2: "",
child2DnaId: "",
child2Id: "",
child2ShortName: "",
child3: "",
child3DnaId: "",
child3Id: "",
child3ShortName: "",
child4: "",
child4DnaId: "",
child4Id: "",
child4ShortName: "",
citizenId: "",
position: "",
posMaster: null,
posLevelName: null,
posLevelRank: null,
posLevelId: null,
posTypeName: null,
posTypeRank: null,
posTypeId: null,
posExecutiveName: "",
posExecutivePriority: null,
dateRetireLaw: "",
dateStart: "",
firstName: "",
isDirector: false,
isProbation: false,
keycloak: "",
lastName: "",
leaveDate: null,
node: 0,
nodeDnaId: "",
nodeId: "",
nodeShortName: "",
posExecutiveId: null,
rootId: null,
posExecutiveName: null,
posExecutivePriority: null,
posLevelId: "",
posLevelName: "",
posLevelRank: 0,
posMaster: 0,
posMasterNo: 0,
posNo: "",
posTypeId: "",
posTypeName: "",
posTypeRank: 0,
position: "",
positionArea: null,
positionExecutiveField: null,
prefix: "",
profileId: "",
profileType: "",
rank: null,
root: "",
child1Id: null,
child1: null,
child2Id: null,
child2: null,
child3Id: null,
child3: null,
child4Id: null,
child4: null,
node: null,
nodeId: null,
rootDnaId: "",
rootId: "",
rootShortName: "",
salary: 0,
});
const dataEvaluation = ref<any>({

View file

@ -481,9 +481,9 @@ async function getProfile() {
if (!store.dataProfile.profileId) {
await http
.get(config.API.profilePosition())
.then(async (res) => {
const data = await res.data.result;
store.dataProfile = await data;
.then((res) => {
const data = res.data.result;
store.dataProfile = data;
})
.catch((e) => {
messageError($q, e);