From 0890fdd951d021308550a0db2e7b6f2593512957 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 30 May 2020 17:27:04 +0200 Subject: initial site copied in --- frontend/api/crud.types.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 frontend/api/crud.types.js (limited to 'frontend/api/crud.types.js') diff --git a/frontend/api/crud.types.js b/frontend/api/crud.types.js new file mode 100644 index 0000000..7a64f5c --- /dev/null +++ b/frontend/api/crud.types.js @@ -0,0 +1,36 @@ + +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=[]) => + with_type(type, actions.concat([ + 'index_loading', + 'index', + 'index_error', + 'index_sort', + 'show_loading', + 'show', + 'show_error', + 'create_loading', + 'create', + 'create_error', + 'update_loading', + 'update', + 'update_error', + 'destroy_loading', + 'destroy', + 'destroy_error', + 'upload_loading', + 'upload_progress', + 'upload_waiting', + 'upload_complete', + 'upload_error', + 'sort', + 'update_option', + 'update_options', + 'loading', + 'loaded', + 'error', + ])) -- cgit v1.2.3-70-g09d2