mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
Merge remote-tracking branch 'origin/accounts_fix'
This commit is contained in:
@@ -95,7 +95,19 @@ export default [
|
|||||||
text: <T id={'banking'} />,
|
text: <T id={'banking'} />,
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
text: <T id={'expenses'} />,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
text: <T id={'expenses'}/>,
|
||||||
|
href: '/expenses-list',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: <T id={'new_expense'}/>,
|
||||||
|
href: '/expenses/new',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text: <T id={'financial_reports'} />,
|
text: <T id={'financial_reports'} />,
|
||||||
children: [
|
children: [
|
||||||
@@ -136,19 +148,6 @@ export default [
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
text: <T id={'expenses'} />,
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
text: <T id={'expenses'}/>,
|
|
||||||
href: '/expenses-list',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: <T id={'new_expense'}/>,
|
|
||||||
href: '/expenses/new',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
divider: true,
|
divider: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect, useState, useMemo, useCallback } from 'react';
|
import React, { useEffect, useState, useMemo, useCallback } from 'react';
|
||||||
import { Route, Switch } from 'react-router-dom';
|
import { Route, Switch } from 'react-router-dom';
|
||||||
import { Alert, Intent } from '@blueprintjs/core';
|
import { Alert, Intent } from '@blueprintjs/core';
|
||||||
import { useQuery } from 'react-query';
|
import { useQuery, queryCache } from 'react-query';
|
||||||
import {
|
import {
|
||||||
FormattedMessage as T,
|
FormattedMessage as T,
|
||||||
FormattedHTMLMessage,
|
FormattedHTMLMessage,
|
||||||
@@ -139,16 +139,22 @@ function AccountsChart({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Handle confirm account activation.
|
// Handle confirm account activation.
|
||||||
|
|
||||||
const handleConfirmAccountActive = useCallback(() => {
|
const handleConfirmAccountActive = useCallback(() => {
|
||||||
requestInactiveAccount(inactiveAccount.id).then(() => {
|
requestInactiveAccount(inactiveAccount.id)
|
||||||
setInactiveAccount(false);
|
.then(() => {
|
||||||
AppToaster.show({
|
setInactiveAccount(false);
|
||||||
message: formatMessage({
|
AppToaster.show({
|
||||||
id: 'the_account_has_been_successfully_inactivated',
|
message: formatMessage({
|
||||||
}),
|
id: 'the_account_has_been_successfully_inactivated',
|
||||||
intent: Intent.SUCCESS,
|
}),
|
||||||
|
intent: Intent.SUCCESS,
|
||||||
|
});
|
||||||
|
queryCache.invalidateQueries('accounts-table');
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
setInactiveAccount(false);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}, [inactiveAccount, requestInactiveAccount, formatMessage]);
|
}, [inactiveAccount, requestInactiveAccount, formatMessage]);
|
||||||
|
|
||||||
// Handle activate account click.
|
// Handle activate account click.
|
||||||
@@ -163,16 +169,21 @@ function AccountsChart({
|
|||||||
|
|
||||||
// Handle activate account confirm.
|
// Handle activate account confirm.
|
||||||
const handleConfirmAccountActivate = useCallback(() => {
|
const handleConfirmAccountActivate = useCallback(() => {
|
||||||
requestActivateAccount(activateAccount.id).then(() => {
|
requestActivateAccount(activateAccount.id)
|
||||||
setActivateAccount(false);
|
.then(() => {
|
||||||
AppToaster.show({
|
setActivateAccount(false);
|
||||||
message: formatMessage({
|
AppToaster.show({
|
||||||
id: 'the_account_has_been_successfully_activated',
|
message: formatMessage({
|
||||||
}),
|
id: 'the_account_has_been_successfully_activated',
|
||||||
intent: Intent.SUCCESS,
|
}),
|
||||||
|
intent: Intent.SUCCESS,
|
||||||
|
});
|
||||||
|
queryCache.invalidateQueries('accounts-table');
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
setActivateAccount(false);
|
||||||
});
|
});
|
||||||
});
|
}, [activateAccount, requestActivateAccount, formatMessage]);
|
||||||
});
|
|
||||||
|
|
||||||
const handleRestoreAccount = (account) => {};
|
const handleRestoreAccount = (account) => {};
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,11 @@ function AccountsDataTable({
|
|||||||
|
|
||||||
const handleNewParentAccount = useCallback(
|
const handleNewParentAccount = useCallback(
|
||||||
(account) => {
|
(account) => {
|
||||||
openDialog('account-form', { action: 'new_child', id: account.id });
|
openDialog('account-form', {
|
||||||
|
action: 'new_child',
|
||||||
|
parentAccountId: account.id,
|
||||||
|
accountTypeId: account.account_type_id,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
[openDialog],
|
[openDialog],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
deleteBulkAccounts,
|
deleteBulkAccounts,
|
||||||
bulkActivateAccounts,
|
bulkActivateAccounts,
|
||||||
bulkInactiveAccounts,
|
bulkInactiveAccounts,
|
||||||
editAccount
|
editAccount,
|
||||||
} from 'store/accounts/accounts.actions';
|
} from 'store/accounts/accounts.actions';
|
||||||
|
|
||||||
const mapActionsToProps = (dispatch) => ({
|
const mapActionsToProps = (dispatch) => ({
|
||||||
@@ -22,9 +22,9 @@ const mapActionsToProps = (dispatch) => ({
|
|||||||
requestActivateAccount: (id) => dispatch(activateAccount({ id })),
|
requestActivateAccount: (id) => dispatch(activateAccount({ id })),
|
||||||
requestFetchAccount: (id) => dispatch(fetchAccount({ id })),
|
requestFetchAccount: (id) => dispatch(fetchAccount({ id })),
|
||||||
requestDeleteBulkAccounts: (ids) => dispatch(deleteBulkAccounts({ ids })),
|
requestDeleteBulkAccounts: (ids) => dispatch(deleteBulkAccounts({ ids })),
|
||||||
requestBulkActivateAccounts:(ids)=>dispatch(bulkActivateAccounts({ids})),
|
requestBulkActivateAccounts: (ids) => dispatch(bulkActivateAccounts({ ids })),
|
||||||
requestBulkInactiveAccounts:(ids)=>dispatch(bulkInactiveAccounts({ids})),
|
requestBulkInactiveAccounts: (ids) => dispatch(bulkInactiveAccounts({ ids })),
|
||||||
requestEditAccount:({id,form}) => dispatch(editAccount({id,form}))
|
requestEditAccount: (id, form) => dispatch(editAccount(id, form)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(null, mapActionsToProps);
|
export default connect(null, mapActionsToProps);
|
||||||
|
|||||||
@@ -8,12 +8,16 @@ import withAccounts from 'containers/Accounts/withAccounts';
|
|||||||
|
|
||||||
export const mapStateToProps = (state, props) => ({
|
export const mapStateToProps = (state, props) => ({
|
||||||
dialogName: 'account-form',
|
dialogName: 'account-form',
|
||||||
|
accountId:
|
||||||
|
props.payload.action === 'edit' && props.payload.id
|
||||||
|
? props.payload.id
|
||||||
|
: null,
|
||||||
});
|
});
|
||||||
const AccountFormDialogConnect = connect(mapStateToProps);
|
const AccountFormDialogConnect = connect(mapStateToProps);
|
||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
AccountFormDialogConnect,
|
|
||||||
withDialogRedux(null, 'account-form'),
|
withDialogRedux(null, 'account-form'),
|
||||||
|
AccountFormDialogConnect,
|
||||||
withAccountsActions,
|
withAccountsActions,
|
||||||
withAccountDetail,
|
withAccountDetail,
|
||||||
withAccounts(({ accountsTypes, accounts }) => ({
|
withAccounts(({ accountsTypes, accounts }) => ({
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
import { useFormik } from 'formik';
|
import { useFormik } from 'formik';
|
||||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||||
|
import { If } from 'components';
|
||||||
import { omit, pick } from 'lodash';
|
import { omit, pick } from 'lodash';
|
||||||
import { useQuery, queryCache } from 'react-query';
|
import { useQuery, queryCache } from 'react-query';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
@@ -61,14 +62,16 @@ function AccountFormDialog({
|
|||||||
.nullable()
|
.nullable()
|
||||||
.required()
|
.required()
|
||||||
.label(formatMessage({ id: 'account_type_id' })),
|
.label(formatMessage({ id: 'account_type_id' })),
|
||||||
description: Yup.string().trim(),
|
description: Yup.string().nullable().trim(),
|
||||||
|
// parent_account_id: Yup.string().nullable(),
|
||||||
});
|
});
|
||||||
|
|
||||||
const initialValues = useMemo(
|
const initialValues = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
account_type_id: null,
|
account_type_id: null,
|
||||||
name: '',
|
name: '',
|
||||||
description: '',
|
description: '',
|
||||||
|
code: '',
|
||||||
|
type: '',
|
||||||
}),
|
}),
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
@@ -94,7 +97,11 @@ function AccountFormDialog({
|
|||||||
} = useFormik({
|
} = useFormik({
|
||||||
enableReinitialize: true,
|
enableReinitialize: true,
|
||||||
initialValues: {
|
initialValues: {
|
||||||
...(payload.action === 'edit' && account ? account : initialValues),
|
// ...initialValues,
|
||||||
|
// ...(payload.action === 'edit' && account ? account : initialValues),
|
||||||
|
|
||||||
|
...(payload.action === 'edit' &&
|
||||||
|
pick(account, Object.keys(initialValues))),
|
||||||
},
|
},
|
||||||
validationSchema: accountFormValidationSchema,
|
validationSchema: accountFormValidationSchema,
|
||||||
onSubmit: (values, { setSubmitting, setErrors }) => {
|
onSubmit: (values, { setSubmitting, setErrors }) => {
|
||||||
@@ -104,21 +111,10 @@ function AccountFormDialog({
|
|||||||
: values.name;
|
: values.name;
|
||||||
|
|
||||||
if (payload.action === 'edit') {
|
if (payload.action === 'edit') {
|
||||||
requestEditAccount({
|
requestEditAccount(payload.id, values)
|
||||||
payload: payload.id,
|
|
||||||
// form: { ...omit(values, [...exclude, 'account_type_id']) },
|
|
||||||
form: {
|
|
||||||
...pick(values, [
|
|
||||||
...exclude,
|
|
||||||
'account_type_id',
|
|
||||||
'name',
|
|
||||||
'description',
|
|
||||||
]),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
closeDialog(dialogName);
|
closeDialog(dialogName);
|
||||||
queryCache.refetchQueries('accounts-table', { force: true });
|
queryCache.invalidateQueries('accounts-table', { force: true });
|
||||||
|
|
||||||
AppToaster.show({
|
AppToaster.show({
|
||||||
message: formatMessage(
|
message: formatMessage(
|
||||||
@@ -137,10 +133,13 @@ function AccountFormDialog({
|
|||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
requestSubmitAccount({ form: { ...omit(values, exclude) } })
|
requestSubmitAccount({
|
||||||
|
payload: payload.parent_account_id,
|
||||||
|
form: { ...omit(values, exclude) },
|
||||||
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
closeDialog(dialogName);
|
closeDialog(dialogName);
|
||||||
queryCache.refetchQueries('accounts-table', { force: true });
|
queryCache.invalidateQueries('accounts-table', { force: true });
|
||||||
|
|
||||||
AppToaster.show({
|
AppToaster.show({
|
||||||
message: formatMessage(
|
message: formatMessage(
|
||||||
@@ -155,6 +154,7 @@ function AccountFormDialog({
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((errors) => {
|
.catch((errors) => {
|
||||||
|
debugger;
|
||||||
const errorsTransformed = transformApiErrors(errors);
|
const errorsTransformed = transformApiErrors(errors);
|
||||||
setErrors({ ...errorsTransformed });
|
setErrors({ ...errorsTransformed });
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
@@ -227,7 +227,7 @@ function AccountFormDialog({
|
|||||||
const fetchAccountsList = useQuery(
|
const fetchAccountsList = useQuery(
|
||||||
'accounts-list',
|
'accounts-list',
|
||||||
() => requestFetchAccounts(),
|
() => requestFetchAccounts(),
|
||||||
{ enabled: true },
|
{ enabled: false },
|
||||||
);
|
);
|
||||||
|
|
||||||
// Fetches accounts types.
|
// Fetches accounts types.
|
||||||
@@ -236,13 +236,13 @@ function AccountFormDialog({
|
|||||||
async () => {
|
async () => {
|
||||||
await requestFetchAccountTypes();
|
await requestFetchAccountTypes();
|
||||||
},
|
},
|
||||||
{ enabled: true },
|
{ enabled: false },
|
||||||
);
|
);
|
||||||
|
|
||||||
// Fetch the given account id on edit mode.
|
// Fetch the given account id on edit mode.
|
||||||
const fetchAccount = useQuery(
|
const fetchAccount = useQuery(
|
||||||
['account', payload.id],
|
['account', payload.id],
|
||||||
(key, id) => requestFetchAccount(id),
|
(key, _id) => requestFetchAccount(_id),
|
||||||
{ enabled: false },
|
{ enabled: false },
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -258,8 +258,13 @@ function AccountFormDialog({
|
|||||||
|
|
||||||
if (payload.action === 'edit' && payload.id) {
|
if (payload.action === 'edit' && payload.id) {
|
||||||
fetchAccount.refetch();
|
fetchAccount.refetch();
|
||||||
}
|
}
|
||||||
}, [payload, fetchAccount, fetchAccountsList, fetchAccountsTypes]);
|
if (payload.action === 'new_child') {
|
||||||
|
setFieldValue('subaccount', true);
|
||||||
|
setFieldValue('parent_account_id', payload.parentAccountId);
|
||||||
|
setFieldValue('account_type_id', payload.accountTypeId);
|
||||||
|
}
|
||||||
|
}, [fetchAccount, fetchAccountsList, fetchAccountsTypes]);
|
||||||
|
|
||||||
const onChangeAccountType = useCallback(
|
const onChangeAccountType = useCallback(
|
||||||
(accountType) => {
|
(accountType) => {
|
||||||
@@ -367,7 +372,7 @@ function AccountFormDialog({
|
|||||||
intent={errors.code && touched.code && Intent.DANGER}
|
intent={errors.code && touched.code && Intent.DANGER}
|
||||||
helperText={<ErrorMessage name="code" {...{ errors, touched }} />}
|
helperText={<ErrorMessage name="code" {...{ errors, touched }} />}
|
||||||
inline={true}
|
inline={true}
|
||||||
labelInfo={<Hint content={<T id='account_code_hint' />} />}
|
labelInfo={<Hint content={<T id="account_code_hint" />} />}
|
||||||
>
|
>
|
||||||
<InputGroup
|
<InputGroup
|
||||||
medium={true}
|
medium={true}
|
||||||
@@ -385,10 +390,11 @@ function AccountFormDialog({
|
|||||||
inline={true}
|
inline={true}
|
||||||
label={subAccountLabel}
|
label={subAccountLabel}
|
||||||
{...getFieldProps('subaccount')}
|
{...getFieldProps('subaccount')}
|
||||||
|
checked={values.subaccount}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
{values.subaccount && (
|
<If condition={values.subaccount}>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={<T id={'parent_account'} />}
|
label={<T id={'parent_account'} />}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
@@ -411,7 +417,7 @@ function AccountFormDialog({
|
|||||||
labelProp={'name'}
|
labelProp={'name'}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
)}
|
</If>
|
||||||
|
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={<T id={'description'} />}
|
label={<T id={'description'} />}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ function CurrencyDialog({
|
|||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
queryCache.refetchQueries('currencies', { force: true });
|
queryCache.invalidateQueries('currencies');
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
@@ -107,7 +107,7 @@ function CurrencyDialog({
|
|||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
queryCache.refetchQueries('currencies', { force: true });
|
queryCache.invalidateQueries('currencies');
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
|
|||||||
@@ -70,8 +70,10 @@ function ExchangeRateDialog({
|
|||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
const fetchExchangeRatesDialog = useQuery('exchange-rates-dialog', () =>
|
const fetchExchangeRatesDialog = useQuery(
|
||||||
requestFetchExchangeRates(),
|
'exchange-rates-dialog',
|
||||||
|
() => requestFetchExchangeRates(),
|
||||||
|
{ manual: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -102,7 +104,7 @@ function ExchangeRateDialog({
|
|||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
queryCache.removeQueries('exchange-rates-dialog', { force: true });
|
queryCache.invalidateQueries('exchange-rates-dialog');
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
@@ -118,7 +120,7 @@ function ExchangeRateDialog({
|
|||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
queryCache.refetchQueries('exchange-rates-table', { force: true });
|
queryCache.invalidateQueries('exchange-rates-table');
|
||||||
})
|
})
|
||||||
.catch((errors) => {
|
.catch((errors) => {
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ function InviteUserDialog({
|
|||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
queryCache.refetchQueries('users-table', { force: true });
|
queryCache.invalidateQueries('users-table');
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
|
|||||||
@@ -106,9 +106,7 @@ function ItemCategoryDialog({
|
|||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
queryCache.refetchQueries('items-categories-table', {
|
queryCache.invalidateQueries('items-categories-table');
|
||||||
force: true,
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
@@ -124,9 +122,7 @@ function ItemCategoryDialog({
|
|||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
queryCache.refetchQueries('items-categories-table', {
|
queryCache.invalidateQueries('items-categories-table');
|
||||||
force: true,
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ function UserFormDialog({
|
|||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
queryCache.refetchQueries('users-table', { force: true });
|
queryCache.invalidateQueries('users-table');
|
||||||
})
|
})
|
||||||
.catch((errors) => {
|
.catch((errors) => {
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
|
|||||||
@@ -48,8 +48,6 @@ function ExpenseForm({
|
|||||||
expenseId,
|
expenseId,
|
||||||
onFormSubmit,
|
onFormSubmit,
|
||||||
onCancelForm,
|
onCancelForm,
|
||||||
onClickAddNewRow,
|
|
||||||
onClickRemoveRow,
|
|
||||||
}) {
|
}) {
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
const [payload, setPayload] = useState({});
|
const [payload, setPayload] = useState({});
|
||||||
@@ -76,16 +74,13 @@ function ExpenseForm({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (expense && expense.id) {
|
if (expense && expense.id) {
|
||||||
changePageTitle(formatMessage({ id: 'edit_expense' }));
|
changePageTitle(formatMessage({ id: 'edit_expense' }));
|
||||||
// changePageSubtitle(`No. ${expenseDetail.payment_account_id}`);
|
|
||||||
} else {
|
} else {
|
||||||
changePageTitle(formatMessage({ id: 'new_expense' }));
|
changePageTitle(formatMessage({ id: 'new_expense' }));
|
||||||
}
|
}
|
||||||
// @todo not functions just states.
|
}, [changePageTitle, expense, formatMessage]);
|
||||||
}, [changePageTitle, changePageSubtitle, expense, formatMessage]);
|
|
||||||
|
|
||||||
const validationSchema = Yup.object().shape({
|
const validationSchema = Yup.object().shape({
|
||||||
beneficiary: Yup.string()
|
beneficiary: Yup.string().label(formatMessage({ id: 'beneficiary' })),
|
||||||
.label(formatMessage({ id: 'beneficiary' })),
|
|
||||||
payment_account_id: Yup.string()
|
payment_account_id: Yup.string()
|
||||||
.required()
|
.required()
|
||||||
.label(formatMessage({ id: 'payment_account_' })),
|
.label(formatMessage({ id: 'payment_account_' })),
|
||||||
@@ -272,7 +267,6 @@ function ExpenseForm({
|
|||||||
const handleSubmitClick = useCallback(
|
const handleSubmitClick = useCallback(
|
||||||
(payload) => {
|
(payload) => {
|
||||||
setPayload(payload);
|
setPayload(payload);
|
||||||
formik.resetForm();
|
|
||||||
formik.handleSubmit();
|
formik.handleSubmit();
|
||||||
},
|
},
|
||||||
[setPayload, formik],
|
[setPayload, formik],
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ function ExpenseTable({
|
|||||||
setRow(newRows);
|
setRow(newRows);
|
||||||
setFieldValue(
|
setFieldValue(
|
||||||
'categories',
|
'categories',
|
||||||
|
|
||||||
newRows.map((row, index) => ({
|
newRows.map((row, index) => ({
|
||||||
...omit(row, ['rowType']),
|
...omit(row, ['rowType']),
|
||||||
index: index + 1,
|
index: index + 1,
|
||||||
|
|||||||
@@ -193,8 +193,6 @@ function GeneralPreferences({
|
|||||||
.label(formatMessage({ id: 'date_format_' })),
|
.label(formatMessage({ id: 'date_format_' })),
|
||||||
});
|
});
|
||||||
|
|
||||||
const query = queryCache.refetchQueries('settings');
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
values,
|
values,
|
||||||
errors,
|
errors,
|
||||||
@@ -224,7 +222,7 @@ function GeneralPreferences({
|
|||||||
});
|
});
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
resetForm();
|
resetForm();
|
||||||
queryCache.refetchQueries('settings', { force: true });
|
queryCache.invalidateQueries('settings');
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ function UsersListPreferences({
|
|||||||
}),
|
}),
|
||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
queryCache.refetchQueries('users-table', { force: true });
|
queryCache.invalidateQueries('users-table');
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setInactiveUserState(false);
|
setInactiveUserState(false);
|
||||||
@@ -108,7 +108,6 @@ function UsersListPreferences({
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Handle confirm User delete
|
// Handle confirm User delete
|
||||||
|
|
||||||
const handleConfirmUserDelete = useCallback(() => {
|
const handleConfirmUserDelete = useCallback(() => {
|
||||||
if (!deleteUserState) {
|
if (!deleteUserState) {
|
||||||
return;
|
return;
|
||||||
@@ -122,7 +121,7 @@ function UsersListPreferences({
|
|||||||
}),
|
}),
|
||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
queryCache.refetchQueries('users-table', { force: true });
|
queryCache.invalidateQueries('users-table');
|
||||||
})
|
})
|
||||||
.catch((errors) => {
|
.catch((errors) => {
|
||||||
setDeleteUserState(false);
|
setDeleteUserState(false);
|
||||||
|
|||||||
@@ -78,8 +78,8 @@ function ViewForm({
|
|||||||
|
|
||||||
const validationSchema = Yup.object().shape({
|
const validationSchema = Yup.object().shape({
|
||||||
resource_name: Yup.string().required(),
|
resource_name: Yup.string().required(),
|
||||||
name: Yup.string().required(),
|
name: Yup.string().required().label(intl.formatMessage({id:'name_'})),
|
||||||
logic_expression: Yup.string().required(),
|
logic_expression: Yup.string().required().label(intl.formatMessage({id:'logic_expression'})),
|
||||||
roles: Yup.array().of(
|
roles: Yup.array().of(
|
||||||
Yup.object().shape({
|
Yup.object().shape({
|
||||||
comparator: Yup.string().required(),
|
comparator: Yup.string().required(),
|
||||||
|
|||||||
@@ -450,6 +450,7 @@ export default {
|
|||||||
as_date: 'As Date',
|
as_date: 'As Date',
|
||||||
aging_before_days: 'Aging before days',
|
aging_before_days: 'Aging before days',
|
||||||
aging_periods: 'Aging periods',
|
aging_periods: 'Aging periods',
|
||||||
|
name_:'name',
|
||||||
as: 'As',
|
as: 'As',
|
||||||
receivable_aging_summary: 'Receivable Aging Summary',
|
receivable_aging_summary: 'Receivable Aging Summary',
|
||||||
customers: 'Customers',
|
customers: 'Customers',
|
||||||
@@ -525,4 +526,5 @@ export default {
|
|||||||
journal_number_is_already_used: 'Journal number is already used.',
|
journal_number_is_already_used: 'Journal number is already used.',
|
||||||
account_code_hint:
|
account_code_hint:
|
||||||
'A unique code/number for this account (limited to 10 characters)',
|
'A unique code/number for this account (limited to 10 characters)',
|
||||||
|
logic_expression: 'logic expression',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,44 +6,48 @@ export const fetchAccountTypes = () => {
|
|||||||
return (dispatch, getState) =>
|
return (dispatch, getState) =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
ApiService.get('account_types')
|
ApiService.get('account_types')
|
||||||
.then(response => {
|
.then((response) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: t.ACCOUNT_TYPES_LIST_SET,
|
type: t.ACCOUNT_TYPES_LIST_SET,
|
||||||
account_types: response.data.account_types
|
account_types: response.data.account_types,
|
||||||
});
|
});
|
||||||
resolve(response);
|
resolve(response);
|
||||||
})
|
})
|
||||||
.catch(error => { reject(error); });
|
.catch((error) => {
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const fetchAccountsList = ({ query } = {}) => {
|
export const fetchAccountsList = ({ query } = {}) => {
|
||||||
return dispatch => new Promise((resolve, reject) => {
|
return (dispatch) =>
|
||||||
dispatch({
|
new Promise((resolve, reject) => {
|
||||||
type: t.SET_DASHBOARD_REQUEST_LOADING,
|
dispatch({
|
||||||
|
type: t.SET_DASHBOARD_REQUEST_LOADING,
|
||||||
|
});
|
||||||
|
ApiService.get('accounts', { params: 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.SET_DASHBOARD_REQUEST_COMPLETED,
|
||||||
|
});
|
||||||
|
resolve(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
dispatch({
|
||||||
|
type: t.SET_DASHBOARD_REQUEST_COMPLETED,
|
||||||
|
});
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
ApiService.get('accounts', { params: 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.SET_DASHBOARD_REQUEST_COMPLETED,
|
|
||||||
});
|
|
||||||
resolve(response);
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
dispatch({
|
|
||||||
type: t.SET_DASHBOARD_REQUEST_COMPLETED,
|
|
||||||
});
|
|
||||||
reject(error);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const fetchAccountsTable = ({ query } = {}) => {
|
export const fetchAccountsTable = ({ query } = {}) => {
|
||||||
@@ -54,7 +58,8 @@ export const fetchAccountsTable = ({ query } = {}) => {
|
|||||||
if (pageQuery.filter_roles) {
|
if (pageQuery.filter_roles) {
|
||||||
pageQuery = {
|
pageQuery = {
|
||||||
...omit(pageQuery, ['filter_roles']),
|
...omit(pageQuery, ['filter_roles']),
|
||||||
stringified_filter_roles: JSON.stringify(pageQuery.filter_roles) || '',
|
stringified_filter_roles:
|
||||||
|
JSON.stringify(pageQuery.filter_roles) || '',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
@@ -69,11 +74,11 @@ export const fetchAccountsTable = ({ query } = {}) => {
|
|||||||
dispatch({
|
dispatch({
|
||||||
type: t.ACCOUNTS_PAGE_SET,
|
type: t.ACCOUNTS_PAGE_SET,
|
||||||
accounts: response.data.accounts,
|
accounts: response.data.accounts,
|
||||||
customViewId: response.data.customViewId
|
customViewId: response.data.customViewId,
|
||||||
});
|
});
|
||||||
dispatch({
|
dispatch({
|
||||||
type: t.ACCOUNTS_ITEMS_SET,
|
type: t.ACCOUNTS_ITEMS_SET,
|
||||||
accounts: response.data.accounts
|
accounts: response.data.accounts,
|
||||||
});
|
});
|
||||||
dispatch({
|
dispatch({
|
||||||
type: t.ACCOUNTS_TABLE_LOADING,
|
type: t.ACCOUNTS_TABLE_LOADING,
|
||||||
@@ -94,29 +99,29 @@ export const fetchAccountsTable = ({ query } = {}) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const fetchAccountsDataTable = ({ query }) => {
|
export const fetchAccountsDataTable = ({ query }) => {
|
||||||
return dispatch =>
|
return (dispatch) =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
ApiService.get('accounts')
|
ApiService.get('accounts')
|
||||||
.then(response => {
|
.then((response) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: t.ACCOUNTS_DATA_TABLE,
|
type: t.ACCOUNTS_DATA_TABLE,
|
||||||
data: response.data
|
data: response.data,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch((error) => {
|
||||||
reject(error);
|
reject(error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const submitAccount = ({ form }) => {
|
export const submitAccount = ({ form }) => {
|
||||||
return dispatch =>
|
return (dispatch) =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: t.SET_DASHBOARD_REQUEST_LOADING,
|
type: t.SET_DASHBOARD_REQUEST_LOADING,
|
||||||
});
|
});
|
||||||
ApiService.post('accounts', form)
|
ApiService.post('accounts', form)
|
||||||
.then(response => {
|
.then((response) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: t.ACCOUNT_ERRORS_CLEAR,
|
type: t.ACCOUNT_ERRORS_CLEAR,
|
||||||
});
|
});
|
||||||
@@ -125,140 +130,147 @@ export const submitAccount = ({ form }) => {
|
|||||||
});
|
});
|
||||||
resolve(response);
|
resolve(response);
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch((error) => {
|
||||||
const { response } = error;
|
const { response } = error;
|
||||||
const { data } = response;
|
const { data } = response;
|
||||||
const { errors } = data;
|
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: t.ACCOUNT_ERRORS_CLEAR,
|
type: t.ACCOUNT_ERRORS_CLEAR,
|
||||||
});
|
});
|
||||||
if (errors) {
|
if (error) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: t.ACCOUNT_ERRORS_SET,
|
type: t.ACCOUNT_ERRORS_SET,
|
||||||
payload: { errors },
|
payload: { error },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
type: t.SET_DASHBOARD_REQUEST_COMPLETED,
|
type: t.SET_DASHBOARD_REQUEST_COMPLETED,
|
||||||
});
|
});
|
||||||
reject(errors);
|
reject(data?.errors);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const editAccount = ({ id, form }) => {
|
export const editAccount = (id, form) => {
|
||||||
return dispatch => new Promise((resolve, reject) => {
|
return (dispatch) =>
|
||||||
dispatch({
|
|
||||||
type: t.SET_DASHBOARD_REQUEST_LOADING,
|
|
||||||
});
|
|
||||||
ApiService.post(`accounts/${id}`, form)
|
|
||||||
.then(response => {
|
|
||||||
dispatch({ type: t.CLEAR_ACCOUNT_FORM_ERRORS });
|
|
||||||
dispatch({
|
|
||||||
type: t.SET_DASHBOARD_REQUEST_COMPLETED,
|
|
||||||
});
|
|
||||||
resolve(response);
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
const { response } = error;
|
|
||||||
const { data } = response;
|
|
||||||
const { errors } = data;
|
|
||||||
|
|
||||||
dispatch({ type: t.CLEAR_ACCOUNT_FORM_ERRORS });
|
|
||||||
if (errors) {
|
|
||||||
dispatch({ type: t.ACCOUNT_FORM_ERRORS, errors });
|
|
||||||
}
|
|
||||||
dispatch({
|
|
||||||
type: t.SET_DASHBOARD_REQUEST_COMPLETED,
|
|
||||||
});
|
|
||||||
reject(errors);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const activateAccount = ({ id }) => {
|
|
||||||
return dispatch => ApiService.post(`accounts/${id}/active`);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const inactiveAccount = ({ id }) => {
|
|
||||||
return dispatch => ApiService.post(`accounts/${id}/inactive`);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const bulkActivateAccounts =({ids})=>{
|
|
||||||
|
|
||||||
return dispatch => new Promise((resolve, reject) => {
|
|
||||||
|
|
||||||
ApiService.post(`accounts/bulk/activate`, null, { params: { ids }}).then((response) => {
|
|
||||||
dispatch({
|
|
||||||
type: t.BULK_ACTIVATE_ACCOUNTS,
|
|
||||||
payload: { ids }
|
|
||||||
});
|
|
||||||
resolve(response);
|
|
||||||
}).catch((error) => {
|
|
||||||
reject(error);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export const bulkInactiveAccounts =({ids})=>{
|
|
||||||
|
|
||||||
return dispatch => new Promise((resolve, reject) => {
|
|
||||||
|
|
||||||
ApiService.post(`accounts/bulk/inactivate`, null, { params: { ids }}).then((response) => {
|
|
||||||
dispatch({
|
|
||||||
type: t.BULK_INACTIVATE_ACCOUNTS,
|
|
||||||
payload: { ids }
|
|
||||||
});
|
|
||||||
resolve(response);
|
|
||||||
}).catch((error) => {
|
|
||||||
reject(error);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const deleteAccount = ({ 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.response.data.errors || []);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const deleteBulkAccounts = ({ ids }) => {
|
|
||||||
return dispatch => new Promise((resolve, reject) => {
|
|
||||||
ApiService.delete(`accounts`, { params: { ids }}).then((response) => {
|
|
||||||
dispatch({
|
|
||||||
type: t.ACCOUNTS_BULK_DELETE,
|
|
||||||
payload: { ids }
|
|
||||||
});
|
|
||||||
resolve(response);
|
|
||||||
}).catch((error) => {
|
|
||||||
const { response } = error;
|
|
||||||
const { data } = response;
|
|
||||||
const { errors } = data;
|
|
||||||
|
|
||||||
reject(errors);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const fetchAccount = ({ id }) => {
|
|
||||||
return dispatch =>
|
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
ApiService.get(`accounts/${id}`)
|
dispatch({
|
||||||
.then(response => {
|
type: t.SET_DASHBOARD_REQUEST_LOADING,
|
||||||
|
});
|
||||||
|
ApiService.post(`accounts/${id}`, form)
|
||||||
|
.then((response) => {
|
||||||
|
dispatch({ type: t.CLEAR_ACCOUNT_FORM_ERRORS });
|
||||||
dispatch({
|
dispatch({
|
||||||
type: t.ACCOUNT_SET,
|
type: t.SET_DASHBOARD_REQUEST_COMPLETED,
|
||||||
account: response.data.account
|
|
||||||
});
|
});
|
||||||
resolve(response);
|
resolve(response);
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch((error) => {
|
||||||
|
const { response } = error;
|
||||||
|
const { data } = response;
|
||||||
|
// const { errors } = data;
|
||||||
|
|
||||||
|
dispatch({ type: t.CLEAR_ACCOUNT_FORM_ERRORS });
|
||||||
|
if (error) {
|
||||||
|
dispatch({ type: t.ACCOUNT_FORM_ERRORS, error });
|
||||||
|
}
|
||||||
|
dispatch({
|
||||||
|
type: t.SET_DASHBOARD_REQUEST_COMPLETED,
|
||||||
|
});
|
||||||
|
reject(data?.errors);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const activateAccount = ({ id }) => {
|
||||||
|
return (dispatch) => ApiService.post(`accounts/${id}/active`);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const inactiveAccount = ({ id }) => {
|
||||||
|
return (dispatch) => ApiService.post(`accounts/${id}/inactive`);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const bulkActivateAccounts = ({ ids }) => {
|
||||||
|
return (dispatch) =>
|
||||||
|
new Promise((resolve, reject) => {
|
||||||
|
ApiService.post(`accounts/bulk/activate`, null, { params: { ids } })
|
||||||
|
.then((response) => {
|
||||||
|
dispatch({
|
||||||
|
type: t.BULK_ACTIVATE_ACCOUNTS,
|
||||||
|
payload: { ids },
|
||||||
|
});
|
||||||
|
resolve(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const bulkInactiveAccounts = ({ ids }) => {
|
||||||
|
return (dispatch) =>
|
||||||
|
new Promise((resolve, reject) => {
|
||||||
|
ApiService.post(`accounts/bulk/inactivate`, null, { params: { ids } })
|
||||||
|
.then((response) => {
|
||||||
|
dispatch({
|
||||||
|
type: t.BULK_INACTIVATE_ACCOUNTS,
|
||||||
|
payload: { ids },
|
||||||
|
});
|
||||||
|
resolve(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const deleteAccount = ({ 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.response.data.errors || []);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const deleteBulkAccounts = ({ ids }) => {
|
||||||
|
return (dispatch) =>
|
||||||
|
new Promise((resolve, reject) => {
|
||||||
|
ApiService.delete(`accounts`, { params: { ids } })
|
||||||
|
.then((response) => {
|
||||||
|
dispatch({
|
||||||
|
type: t.ACCOUNTS_BULK_DELETE,
|
||||||
|
payload: { ids },
|
||||||
|
});
|
||||||
|
resolve(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
const { response } = error;
|
||||||
|
const { data } = response;
|
||||||
|
// const { errors } = data;
|
||||||
|
|
||||||
|
reject(data?.errors);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const fetchAccount = ({ id }) => {
|
||||||
|
return (dispatch) =>
|
||||||
|
new Promise((resolve, reject) => {
|
||||||
|
ApiService.get(`accounts/${id}`)
|
||||||
|
.then((response) => {
|
||||||
|
dispatch({
|
||||||
|
type: t.ACCOUNT_SET,
|
||||||
|
account: response.data.account,
|
||||||
|
});
|
||||||
|
resolve(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
reject(error);
|
reject(error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user