summaryrefslogtreecommitdiff
path: root/frontend/api/index.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-05-30 17:27:04 +0200
committerJules Laplace <julescarbon@gmail.com>2020-05-30 17:27:04 +0200
commit0890fdd951d021308550a0db2e7b6f2593512957 (patch)
treea0050b153242ccde662fc0a957a79fc7a7edc4b4 /frontend/api/index.js
initial site copied in
Diffstat (limited to 'frontend/api/index.js')
-rw-r--r--frontend/api/index.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/frontend/api/index.js b/frontend/api/index.js
new file mode 100644
index 0000000..b33d2e6
--- /dev/null
+++ b/frontend/api/index.js
@@ -0,0 +1,28 @@
+import { crud_actions } from './crud.actions'
+import * as util from '../util'
+
+/*
+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 { util }
+
+export const actions = [
+ 'collection',
+ 'upload',
+ 'media',
+ 'featureIndex',
+ 'detectionIndex',
+ 'detection',
+ 'modelzoo',
+ 'mediaImport',
+].reduce((a,b) => (a[b] = crud_actions(b)) && a, {})