From 15277d3a0329ceed0a137b72cec3852f3923fb95 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Wed, 28 Aug 2024 08:48:19 +0700 Subject: [PATCH] fix: wrong detect customer type --- src/pages/03_customer-management/form.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pages/03_customer-management/form.ts b/src/pages/03_customer-management/form.ts index 987a3219..0a8795ad 100644 --- a/src/pages/03_customer-management/form.ts +++ b/src/pages/03_customer-management/form.ts @@ -312,6 +312,7 @@ export const useCustomerForm = defineStore('form-customer', () => { export const useCustomerBranchForm = defineStore('form-customer-branch', () => { const customerStore = useCustomerStore(); + const customerFormStore = useCustomerForm(); const defaultFormData: CustomerBranchCreate & { id?: string } = { code: '', @@ -442,6 +443,10 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => { if (!currentFormData.value.id) { const res = await customerStore.createBranch({ ...currentFormData.value, + citizenId: + customerFormStore.currentFormData.customerType === 'CORP' + ? undefined + : currentFormData.value.citizenId, customerId: state.value.currentCustomerId, }); if (res) return res;