mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
Compare commits
2 Commits
easysms-in
...
v0.4.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f0700b5e5 | ||
|
|
48348da663 |
@@ -1,5 +1,6 @@
|
|||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
|
import { isEmpty } from 'lodash';
|
||||||
|
|
||||||
export const transformApiErrors = (errors) => {
|
export const transformApiErrors = (errors) => {
|
||||||
const fields = {};
|
const fields = {};
|
||||||
@@ -42,12 +43,18 @@ const mergeWithAccount = R.curry((transformed, account) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default account payload transformer.
|
||||||
|
*/
|
||||||
|
const defaultPayloadTransform = () => ({});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defined payload transformers.
|
* Defined payload transformers.
|
||||||
*/
|
*/
|
||||||
function getConditions() {
|
function getConditions() {
|
||||||
return [
|
return [
|
||||||
['edit', transformEditMode],
|
['edit'],
|
||||||
|
['new_child', transformEditMode],
|
||||||
['NEW_ACCOUNT_DEFINED_TYPE', transformNewAccountDefinedType],
|
['NEW_ACCOUNT_DEFINED_TYPE', transformNewAccountDefinedType],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -59,9 +66,13 @@ export const transformAccountToForm = (account, payload) => {
|
|||||||
const conditions = getConditions();
|
const conditions = getConditions();
|
||||||
|
|
||||||
const results = conditions.map((condition) => {
|
const results = conditions.map((condition) => {
|
||||||
|
const transformer = !isEmpty(condition[1])
|
||||||
|
? condition[1]
|
||||||
|
: defaultPayloadTransform;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
condition[0] === payload.action ? R.T : R.F,
|
condition[0] === payload.action ? R.T : R.F,
|
||||||
mergeWithAccount(condition[1](payload)),
|
mergeWithAccount(transformer(payload)),
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
return R.cond(results)(account);
|
return R.cond(results)(account);
|
||||||
|
|||||||
@@ -21,12 +21,12 @@ export default [
|
|||||||
loader: () => import('containers/Authentication/ResetPassword'),
|
loader: () => import('containers/Authentication/ResetPassword'),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// path: `${BASE_URL}/invite/:token/accept`,
|
path: `${BASE_URL}/invite/:token/accept`,
|
||||||
// component: LazyLoader({
|
component: LazyLoader({
|
||||||
// loader: () => import('containers/Authentication/InviteAccept'),
|
loader: () => import('containers/Authentication/InviteAccept'),
|
||||||
// }),
|
}),
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
path: `${BASE_URL}/register`,
|
path: `${BASE_URL}/register`,
|
||||||
component: LazyLoader({
|
component: LazyLoader({
|
||||||
|
|||||||
Reference in New Issue
Block a user