From ab1ea1f614ee2a7ce9447747341912a2820cef30 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 23 Apr 2026 18:09:48 +0700 Subject: [PATCH] fix: fetchData position review --- .../10_registry/components/PositionReview/Table.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 }, +);