From d15bb7ef6fcb3c1522bfb04cf6d09020b4fe58ee Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Thu, 10 Oct 2024 13:33:08 +0700 Subject: [PATCH] refactor:subitm return status --- src/pages/05_quotation/form.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pages/05_quotation/form.ts b/src/pages/05_quotation/form.ts index 4b7145ef..89432e1d 100644 --- a/src/pages/05_quotation/form.ts +++ b/src/pages/05_quotation/form.ts @@ -130,7 +130,6 @@ export const useQuotationForm = defineStore('form-quotation', () => { currentFormData.value = structuredClone(resetFormData); - console.log('ทำงาน'); currentFormState.value.mode = mode; } @@ -148,13 +147,20 @@ export const useQuotationForm = defineStore('form-quotation', () => { file: v.file, }); }); + return true; } } if (currentFormState.value.mode === 'edit' && currentFormData.value.id) { - await quotationStore.editQuotation({ + if (currentFormData.value.status === 'CREATED') { + delete currentFormData.value?.['status']; + } + + const res = await quotationStore.editQuotation({ ...currentFormData.value, id: currentFormData.value.id, }); + + if (res) return true; } currentFormState.value.mode = 'info';