refactor: wrong code

This commit is contained in:
Methapon Metanipat 2024-10-03 09:47:43 +07:00
parent 284028aff0
commit 362cb7c15a

View file

@ -1,26 +1,17 @@
import { defineStore } from 'pinia';
import { ref } from 'vue';
// NOTE at type
// NOTE: Import types
import { QuotationPayload, EmployeeWorker } from 'src/stores/quotations/types';
// NOTE: Import stores
import { useQuotationStore } from 'stores/quotations';
export const useQuotationForm = defineStore('form-quotation', () => {
const quotationStore = useQuotationStore();
const defaultFormData: QuotationPayload = {
productServiceList: [
{
vat: 0,
pricePerUnit: 0,
discount: 0,
amount: 0,
productId: '',
workId: '',
serviceId: '',
},
],
productServiceList: [],
urgent: false,
customerBranchId: '',
worker: [],
@ -37,7 +28,7 @@ export const useQuotationForm = defineStore('form-quotation', () => {
actorName: '',
status: 'CREATED',
};
const resetFormData = structuredClone(defaultFormData);
let resetFormData = structuredClone(defaultFormData);
const currentFormData = ref<QuotationPayload>(structuredClone(resetFormData));
@ -59,7 +50,11 @@ export const useQuotationForm = defineStore('form-quotation', () => {
currentFormData.value = structuredClone(resetFormData);
}
async function assignFormData(id: string) {}
async function assignFormData(id: string) {
const data = await quotationStore.getQuotation(id);
if (!data) return; // NOTE: Error should be handled globally by axios instance
}
function submiQuotationt() {}