mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
feat: deliver status in invoice.
This commit is contained in:
@@ -121,31 +121,35 @@ export const fetchInvoice = ({ id }) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const fetchDueInvoices = ({ customerId }) => (dispatch) => new Promise((resovle, reject) => {
|
||||
export const fetchDueInvoices = ({ customerId }) => (dispatch) =>
|
||||
new Promise((resovle, reject) => {
|
||||
ApiService.get(`sales/invoices/payable`, {
|
||||
params: { customer_id: customerId },
|
||||
})
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.INVOICES_ITEMS_SET,
|
||||
payload: {
|
||||
sales_invoices: response.data.sales_invoices,
|
||||
},
|
||||
});
|
||||
if (customerId) {
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.INVOICES_RECEIVABLE_BY_CUSTOMER_ID,
|
||||
type: t.INVOICES_ITEMS_SET,
|
||||
payload: {
|
||||
customerId,
|
||||
saleInvoices: response.data.sales_invoices,
|
||||
sales_invoices: response.data.sales_invoices,
|
||||
},
|
||||
});
|
||||
}
|
||||
resovle(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
const { response } = error;
|
||||
const { data } = response;
|
||||
reject(data?.errors);
|
||||
});
|
||||
if (customerId) {
|
||||
dispatch({
|
||||
type: t.INVOICES_RECEIVABLE_BY_CUSTOMER_ID,
|
||||
payload: {
|
||||
customerId,
|
||||
saleInvoices: response.data.sales_invoices,
|
||||
},
|
||||
});
|
||||
}
|
||||
resovle(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
const { response } = error;
|
||||
const { data } = response;
|
||||
reject(data?.errors);
|
||||
});
|
||||
});
|
||||
export const deliverInvoice = ({ id }) => {
|
||||
return (dispatch) => ApiService.post(`sales/invoices/${id}/deliver`);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user