From a96161ffc2c72734c9b39527ab55c148ce5a40b5 Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Fri, 7 Jun 2024 14:16:38 +0700 Subject: [PATCH] =?UTF-8?q?feat:=20fetchListById=20=E0=B9=81=E0=B8=A5?= =?UTF-8?q?=E0=B8=B0=20by=E0=B8=84=E0=B9=88=E0=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomerInfoComponent.vue | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/components/03_customer-management/CustomerInfoComponent.vue b/src/components/03_customer-management/CustomerInfoComponent.vue index f17f9034..c8d5821e 100644 --- a/src/components/03_customer-management/CustomerInfoComponent.vue +++ b/src/components/03_customer-management/CustomerInfoComponent.vue @@ -2,17 +2,30 @@ import { ref } from 'vue'; import AppBox from 'components/app/AppBox.vue'; import BranchCardCustomer from 'components/03_customer-management/BranchCardCustomer.vue'; +import { onMounted } from 'vue'; +import useCustomerStore from 'src/stores/customer'; +import { CustomerBranch } from 'src/stores/customer/types'; + +const userCustomer = useCustomerStore(); +const { fetchListById } = userCustomer; const inputSearch = ref(''); +const branch = ref(); -withDefaults( +const prop = withDefaults( defineProps<{ color: 'purple' | 'green'; + customerId: string; }>(), { color: 'green', }, ); + +onMounted(async () => { + const result = await fetchListById(prop.customerId); + if (result) branch.value = result.branch; +});