refactor:subitm return status

This commit is contained in:
Thanaphon Frappet 2024-10-10 13:33:08 +07:00
parent a066b2c843
commit d15bb7ef6f

View file

@ -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';