diff options
Diffstat (limited to 'app/client/api')
| -rw-r--r-- | app/client/api/crud.types.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/client/api/crud.types.js b/app/client/api/crud.types.js index 630bf83..83be34d 100644 --- a/app/client/api/crud.types.js +++ b/app/client/api/crud.types.js @@ -1,8 +1,11 @@ export const as_type = (a, b) => [a, b].join('_').toUpperCase() +export const with_type = (type, actions) => + actions.reduce((a, b) => (a[b] = as_type(type, b)) && a, {}) + export const crud_type = (type, actions=[]) => - actions.concat([ + with_type(type, actions.concat([ 'index_loading', 'index', 'index_error', @@ -24,5 +27,4 @@ export const crud_type = (type, actions=[]) => 'upload_complete', 'upload_error', 'sort', - ]) - .reduce((a, b) => (a[b] = as_type(type, b)) && a, {}) + ])) |
