refactor: handle _count

This commit is contained in:
Thanaphon Frappet 2024-10-07 17:04:12 +07:00
parent fc52acf541
commit c1a9d93026

View file

@ -59,10 +59,12 @@ export const useQuotationStore = defineStore('quotation-store', () => {
return null; return null;
} }
async function createQuotation(payload: QuotationPayload) { async function createQuotation(data: QuotationPayload) {
const { _count, ...payload } = data;
const res = await api.post('/quotation', { const res = await api.post('/quotation', {
...payload, ...payload,
productServiceList: payload.productServiceList.map((v) => ({ productServiceList: data.productServiceList.map((v) => ({
vat: v.vat, vat: v.vat,
amount: v.amount, amount: v.amount,
pricePerUnit: v.pricePerUnit, pricePerUnit: v.pricePerUnit,