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 * as R from 'ramda';
|
||||
import { isEmpty } from 'lodash';
|
||||
|
||||
export const transformApiErrors = (errors) => {
|
||||
const fields = {};
|
||||
@@ -42,12 +43,18 @@ const mergeWithAccount = R.curry((transformed, account) => {
|
||||
};
|
||||
});
|
||||
|
||||
/**
|
||||
* Default account payload transformer.
|
||||
*/
|
||||
const defaultPayloadTransform = () => ({});
|
||||
|
||||
/**
|
||||
* Defined payload transformers.
|
||||
*/
|
||||
function getConditions() {
|
||||
return [
|
||||
['edit', transformEditMode],
|
||||
['edit'],
|
||||
['new_child', transformEditMode],
|
||||
['NEW_ACCOUNT_DEFINED_TYPE', transformNewAccountDefinedType],
|
||||
];
|
||||
}
|
||||
@@ -59,9 +66,13 @@ export const transformAccountToForm = (account, payload) => {
|
||||
const conditions = getConditions();
|
||||
|
||||
const results = conditions.map((condition) => {
|
||||
const transformer = !isEmpty(condition[1])
|
||||
? condition[1]
|
||||
: defaultPayloadTransform;
|
||||
|
||||
return [
|
||||
condition[0] === payload.action ? R.T : R.F,
|
||||
mergeWithAccount(condition[1](payload)),
|
||||
mergeWithAccount(transformer(payload)),
|
||||
];
|
||||
});
|
||||
return R.cond(results)(account);
|
||||
|
||||
@@ -21,12 +21,12 @@ export default [
|
||||
loader: () => import('containers/Authentication/ResetPassword'),
|
||||
}),
|
||||
},
|
||||
// {
|
||||
// path: `${BASE_URL}/invite/:token/accept`,
|
||||
// component: LazyLoader({
|
||||
// loader: () => import('containers/Authentication/InviteAccept'),
|
||||
// }),
|
||||
// },
|
||||
{
|
||||
path: `${BASE_URL}/invite/:token/accept`,
|
||||
component: LazyLoader({
|
||||
loader: () => import('containers/Authentication/InviteAccept'),
|
||||
}),
|
||||
},
|
||||
{
|
||||
path: `${BASE_URL}/register`,
|
||||
component: LazyLoader({
|
||||
|
||||
Reference in New Issue
Block a user