fix: fetchData position review
This commit is contained in:
parent
3da965dc0e
commit
ab1ea1f614
1 changed files with 10 additions and 2 deletions
|
|
@ -886,12 +886,20 @@ async function fetchDataCommandCode() {
|
|||
// }
|
||||
|
||||
onMounted(async () => {
|
||||
// เพิ่ม delay เล็กน้อยเพื่อรอให้ dataStore fetch ข้อมูล position เสร็จก่อน
|
||||
await new Promise((resolve) => setTimeout(resolve, 800));
|
||||
if (dataStore.officerType && dataStore.profileId) {
|
||||
await Promise.all([fetchData(), fetchDataCommandCode()]);
|
||||
}
|
||||
});
|
||||
|
||||
watch(
|
||||
() => [dataStore.officerType, dataStore.profileId],
|
||||
async ([officerType, profileId]) => {
|
||||
if (officerType && profileId) {
|
||||
await Promise.all([fetchData(), fetchDataCommandCode()]);
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue