Compare commits

...

2 Commits

Author SHA1 Message Date
a.bouhuolia
5f0700b5e5 fix: hotbug account dialog edit payload transformation. 2021-11-20 18:52:45 +02:00
a.bouhuolia
48348da663 fix: invite user auth route. 2021-11-20 15:49:28 +02:00
2 changed files with 19 additions and 8 deletions

View File

@@ -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);

View File

@@ -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({