diff --git a/src/modules/10_registry/components/PositionReview/Table.vue b/src/modules/10_registry/components/PositionReview/Table.vue index a79e32f..4523be3 100644 --- a/src/modules/10_registry/components/PositionReview/Table.vue +++ b/src/modules/10_registry/components/PositionReview/Table.vue @@ -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 }, +);