From 1fb8a9e663238eb15e1f92b93c5484867ea9feec Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 29 May 2018 02:07:53 +0200 Subject: default crud actions.. --- app/client/api/index.js | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'app/client/api/index.js') diff --git a/app/client/api/index.js b/app/client/api/index.js index 8db9c23..4e894e2 100644 --- a/app/client/api/index.js +++ b/app/client/api/index.js @@ -1,19 +1,12 @@ import FormData from 'form-data' import fetch from 'node-fetch' -import { crud_fetch, postBody } from './crud.fetch' +import { crud_actions } from './crud.actions' -export const folder = crud_fetch('folder') -export const file = crud_fetch('file') -export const dataset = crud_fetch('dataset') -export const task = crud_fetch('task') - -// folder.upload = (folder_id, files) => { -// var data = new FormData() -// for (var i = 0; i < files.length; i++) { -// data.append('file', files[i]) -// } -// return fetch('/api/folders/' + folder_id, postBody(data)) -// .then(req => req.json()) -// .catch(error) -// } +export default [ + 'folder', + 'file', + 'dataset', + 'task', + 'user', +].reduce((a,b) => (a[b]=crud_actions(b))&&a, {}) -- cgit v1.2.3-70-g09d2