From d1afb438ea33a33e436fb6688940dd3c929fe3fd Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Fri, 9 Aug 2024 17:57:19 +0700 Subject: [PATCH] feat: auto reset form customer branch --- src/pages/03_customer-management/form.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pages/03_customer-management/form.ts b/src/pages/03_customer-management/form.ts index fea23d66..0d00d035 100644 --- a/src/pages/03_customer-management/form.ts +++ b/src/pages/03_customer-management/form.ts @@ -334,6 +334,15 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => { ); } + watch( + () => state.value.dialogType, + () => { + if (state.value.dialogType === 'create') { + currentFormData.value = structuredClone(defaultFormData); + } + }, + ); + async function submitForm() { if (!state.value.currentCustomerId) { throw new Error(