From 875e3177958f19688f066b1323d014abede70003 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Thu, 7 Dec 2023 20:52:45 +0530 Subject: bug fix: billing/shipping address not getting sent properly --- src/components/invoice_header_editor.vue | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/components') diff --git a/src/components/invoice_header_editor.vue b/src/components/invoice_header_editor.vue index 6bd62b8..964bd04 100644 --- a/src/components/invoice_header_editor.vue +++ b/src/components/invoice_header_editor.vue @@ -44,12 +44,27 @@ const submit = async (e: Event) => { try { const c = toRaw(customer.value) + console.log(c.BillingAddress) const res = await axios.post('/invoice', { "invoicedate": new Date(toRaw(invoiceDate.value)).toISOString(), "isdraft": true, - "billingaddress": c.BillingAddress, - "shippingaddress": c.BillingAddress, // TODO + "BillingAddress": { + // NOTE: just c.BillingAddress doesn't work for some reason + "AddressText": c.BillingAddress.AddressText, + "City": c.BillingAddress.City, + "State": c.BillingAddress.State, + "PostalCode": c.BillingAddress.PostalCode, + "Country": c.BillingAddress.Country, + }, + "ShippingAddress": { + // TODO: don't use the billing address! + "AddressText": c.BillingAddress.AddressText, + "City": c.BillingAddress.City, + "State": c.BillingAddress.State, + "PostalCode": c.BillingAddress.PostalCode, + "Country": c.BillingAddress.Country, + }, "customername": c.Name, "customergstin": c.Gstin, "customercontactname": c.ContactName, -- cgit v1.2.3