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; +});