diff options
Diffstat (limited to 'app/client/api')
| -rw-r--r-- | app/client/api/crud.actions.js | 12 | ||||
| -rw-r--r-- | app/client/api/index.js | 15 |
2 files changed, 14 insertions, 13 deletions
diff --git a/app/client/api/crud.actions.js b/app/client/api/crud.actions.js index 59d4d82..583a9cf 100644 --- a/app/client/api/crud.actions.js +++ b/app/client/api/crud.actions.js @@ -2,18 +2,6 @@ import crud from './crud.fetch' import { as_type } from './crud.types' import { uploadAction } from './crud.upload' -/* -for our crud events, create corresponding actions -the actions fire a 'loading' event, call the underlying api method, and then resolve. -so you can do ... - var folderActions = crud_actions('folder') - folderActions.index({ module: 'samplernn' }) - folderActions.show(12) - folderActions.create({ module: 'samplernn', name: 'foo' }) - folderActions.update(12, { module: 'pix2pix' }) - folderActions.destroy(12, { confirm: true }) -*/ - export function crud_actions(type) { const fetch_type = crud_fetch(type) return [ diff --git a/app/client/api/index.js b/app/client/api/index.js index 4e894e2..6f12227 100644 --- a/app/client/api/index.js +++ b/app/client/api/index.js @@ -3,10 +3,23 @@ import fetch from 'node-fetch' import { crud_actions } from './crud.actions' +/* +for our crud events, create corresponding actions +the actions fire a 'loading' event, call the underlying api method, and then resolve. +so you can do ... + import { folderActions } from '../../api' + folderActions.index({ module: 'samplernn' }) + folderActions.show(12) + folderActions.create({ module: 'samplernn', name: 'foo' }) + folderActions.update(12, { module: 'pix2pix' }) + folderActions.destroy(12, { confirm: true }) + folderActions.upload(12, form_data) +*/ + export default [ 'folder', 'file', 'dataset', 'task', 'user', -].reduce((a,b) => (a[b]=crud_actions(b))&&a, {}) +].reduce((a,b) => (a[b + 'Actions'] = crud_actions(b)) && a, {}) |
