mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
Fix Customers
This commit is contained in:
@@ -37,7 +37,7 @@ export const fetchCustomers = ({ query }) => {
|
||||
return (dispatch, getState) =>
|
||||
new Promise((resolve, reject) => {
|
||||
const pageQuery = getState().customers.tableQuery;
|
||||
|
||||
|
||||
dispatch({
|
||||
type: t.CUSTOMERS_TABLE_LOADING,
|
||||
payload: { loading: true },
|
||||
@@ -99,14 +99,14 @@ export const fetchCustomer = ({ id }) => {
|
||||
|
||||
export const deleteCustomer = ({ id }) => {
|
||||
return (dispatch) =>
|
||||
new Promise((resolve, reject) => {
|
||||
new Promise((resovle, reject) => {
|
||||
ApiService.delete(`customers/${id}`)
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: t.CUSTOMER_DELETE,
|
||||
payload: { id },
|
||||
});
|
||||
resolve(response);
|
||||
resovle(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error.response.data.errors || []);
|
||||
|
||||
@@ -55,9 +55,8 @@ const customersReducer = createReducer(initialState, {
|
||||
|
||||
[t.CUSTOMER_DELETE]: (state, action) => {
|
||||
const { id } = action.payload;
|
||||
|
||||
if (typeof state.items[id] !== 'undefined') {
|
||||
delete state.items[action.id];
|
||||
delete state.items[id];
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user