From 99781c2b1e5f415df54ddbf8a1e8299b9d8e61ee Mon Sep 17 00:00:00 2001 From: Net Date: Tue, 13 Aug 2024 16:43:34 +0700 Subject: [PATCH] refactor: return data --- src/pages/03_customer-management/form.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/03_customer-management/form.ts b/src/pages/03_customer-management/form.ts index 7f5c3e48..1306b887 100644 --- a/src/pages/03_customer-management/form.ts +++ b/src/pages/03_customer-management/form.ts @@ -359,15 +359,18 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => { } if (!currentFormData.value.id) { - await customerStore.createBranch({ + const res = await customerStore.createBranch({ ...currentFormData.value, customerId: state.value.currentCustomerId, }); + if(res) return res + } else { - await customerStore.editBranchById(currentFormData.value.id, { + const res = await customerStore.editBranchById(currentFormData.value.id, { ...currentFormData.value, id: undefined, }); + if(res) return res } }