1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

created fake file uploader

This commit is contained in:
muerwre 2019-08-07 15:40:28 +07:00
parent d73437d8c6
commit 3eafd990cb
2 changed files with 9 additions and 6 deletions

View file

@ -5,7 +5,7 @@ import { reqWrapper } from '../auth/sagas';
import { createUploader, uploadGetThumb, fakeUploader } from '~/utils/uploader';
import { HTTP_RESPONSES } from '~/utils/api';
import { VALIDATORS } from '~/utils/validators';
import { UUID, IFileWithUUID } from '../types';
import { UUID, IFileWithUUID, IResultWithStatus, IFile } from '../types';
function* uploadCall({ temp_id, onProgress, file }) {
return yield call(reqWrapper, fakeUploader, { file: { url: 'some', error: 'cant do this boss' }, onProgress, mustSucceed: true });
@ -68,7 +68,7 @@ function* uploadFile({ file, temp_id }: IFileWithUUID) {
return yield put(uploadDropStatus(temp_id));
}
const { data, error } = result;
const { data, error }: IResultWithStatus<IFile> = result;
if (error) {
return yield put(
@ -76,13 +76,15 @@ function* uploadFile({ file, temp_id }: IFileWithUUID) {
);
}
console.log('upload', data);
yield put(
uploadSetStatus(temp_id, {
is_uploading: false,
error: null,
uuid: data.uuid,
url: data.url,
thumbnail_url: data.url,
uuid: data.id,
url: data.full_path,
thumbnail_url: data.full_path,
})
);