mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
feat: Accounts datatable.
This commit is contained in:
@@ -12,9 +12,7 @@ export const fetchAccountTypes = () => {
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
.catch(error => { reject(error); });
|
||||
});
|
||||
};
|
||||
|
||||
@@ -40,6 +38,38 @@ export const fetchAccountsList = ({ query } = {}) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const fetchAccountsTable = ({ query } = {}) => {
|
||||
return (dispatch, getState) =>
|
||||
new Promise((resolve, reject) => {
|
||||
const pageQuery = getState().accounts.tableQuery;
|
||||
|
||||
dispatch({
|
||||
type: t.ACCOUNTS_TABLE_LOADING,
|
||||
loading: true,
|
||||
});
|
||||
ApiService.get('accounts', { params: { ...pageQuery, ...query } })
|
||||
.then(response => {
|
||||
dispatch({
|
||||
type: t.ACCOUNTS_PAGE_SET,
|
||||
accounts: response.data.accounts,
|
||||
customViewId: response.data.customViewId
|
||||
});
|
||||
dispatch({
|
||||
type: t.ACCOUNTS_ITEMS_SET,
|
||||
accounts: response.data.accounts
|
||||
});
|
||||
dispatch({
|
||||
type: t.ACCOUNTS_TABLE_LOADING,
|
||||
loading: false,
|
||||
});
|
||||
resolve(response);
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const fetchAccountsDataTable = ({ query }) => {
|
||||
return dispatch =>
|
||||
new Promise((resolve, reject) => {
|
||||
@@ -109,7 +139,12 @@ export const inactiveAccount = ({ id }) => {
|
||||
};
|
||||
|
||||
export const deleteAccount = ({ id }) => {
|
||||
return dispatch => ApiService.delete(`accounts/${id}`);
|
||||
return dispatch => new Promise((resolve, reject) => {
|
||||
ApiService.delete(`accounts/${id}`).then((response) => {
|
||||
dispatch({ type: t.ACCOUNT_DELETE, id });
|
||||
resolve(response);
|
||||
}).catch(error => { reject(error); });
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteBulkAccounts = ({ ids }) => {};
|
||||
|
||||
Reference in New Issue
Block a user