diff options
Diffstat (limited to 'app/client/api/crud.upload.js')
| -rw-r--r-- | app/client/api/crud.upload.js | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/app/client/api/crud.upload.js b/app/client/api/crud.upload.js index 26917ff..f680a74 100644 --- a/app/client/api/crud.upload.js +++ b/app/client/api/crud.upload.js @@ -1,6 +1,6 @@ import { as_type } from './crud.types' -export function crud_upload(type, id, fd, dispatch) => { +export function crud_upload(type, id, fd, dispatch) { return new Promise( (resolve, reject) => { const xhr = new XMLHttpRequest() xhr.upload.addEventListener("progress", uploadProgress, false) @@ -42,7 +42,7 @@ export function crud_upload(type, id, fd, dispatch) => { } dispatch && dispatch({ type: as_type(type, 'upload_complete'), - data + data, [type]: id, }) } @@ -58,13 +58,11 @@ export function crud_upload(type, id, fd, dispatch) => { uploadCancelled = function (evt) { dispatch && dispatch({ type: as_type(type, 'upload_error'), - error: 'upload cancelled' + error: 'upload cancelled', [type]: id, }) } }) } -export function uploadAction(type, id, fd) { - return dispatch => crud_upload(type, id, fd, dispatch) -}
\ No newline at end of file +export const upload_action = (type, id, fd) => dispatch => crud_upload(type, id, fd, dispatch) |
