1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-05-01 23:56:41 +07:00

fetching files

This commit is contained in:
muerwre 2019-08-07 17:52:48 +07:00
parent 1aff4d5b73
commit ec91c5533b
5 changed files with 34 additions and 8 deletions

View file

@ -1,6 +1,6 @@
import { takeEvery, all, spawn, call, put, take, fork, race } from 'redux-saga/effects';
import { UPLOAD_ACTIONS } from '~/redux/uploads/constants';
import { uploadUploadFiles, uploadSetStatus, uploadAddStatus, uploadDropStatus } from './actions';
import { uploadUploadFiles, uploadSetStatus, uploadAddStatus, uploadDropStatus, uploadAddFile } from './actions';
import { reqWrapper } from '../auth/sagas';
import { createUploader, uploadGetThumb, fakeUploader } from '~/utils/uploader';
import { HTTP_RESPONSES } from '~/utils/api';
@ -68,7 +68,7 @@ function* uploadFile({ file, temp_id }: IFileWithUUID) {
return yield put(uploadDropStatus(temp_id));
}
const { data, error }: IResultWithStatus<IFile> = result;
const { data, error }: { data: IFile & { detail: any }; error: string } = result;
if (error) {
return yield put(
@ -89,6 +89,8 @@ function* uploadFile({ file, temp_id }: IFileWithUUID) {
})
);
yield put(uploadAddFile(data));
return { error: null, status: HTTP_RESPONSES.CREATED, data: {} }; // add file here as data
}