mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
Fix: specific item api & customer api
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { resolve } from 'p-progress';
|
||||
import ApiService from 'services/ApiService';
|
||||
import t from 'store/types';
|
||||
|
||||
@@ -52,10 +53,9 @@ export const fetchCustomers = ({ query }) => {
|
||||
ApiService.get(`customers`, { params: { ...pageQuery, ...query } })
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.CUSTOMER_SET,
|
||||
type: t.CUSTOMERS_ITEMS_SET,
|
||||
customers: response.data.customers,
|
||||
});
|
||||
|
||||
dispatch({
|
||||
type: t.CUSTOMERS_PAGE_SET,
|
||||
customers: response.data.customers,
|
||||
@@ -74,6 +74,26 @@ export const fetchCustomers = ({ query }) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const fetchCustomer = ({ id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
ApiService.get(`customers/${id}`)
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.CUSTOMER_SET,
|
||||
payload: {
|
||||
id,
|
||||
customer: response.data.contact,
|
||||
},
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteCustomer = ({ id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
|
||||
Reference in New Issue
Block a user