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

fixed uploads with real data

This commit is contained in:
muerwre 2019-08-20 12:05:50 +07:00
parent db0a94b581
commit 38d56838f2
5 changed files with 127 additions and 58 deletions

View file

@ -1,4 +1,4 @@
import { IFile } from '~/redux/types';
import { IFile, IUploadType } from '~/redux/types';
import { IUploadState, IUploadStatus } from './reducer';
const prefix = 'UPLOAD.';
@ -11,7 +11,7 @@ export const UPLOAD_ACTIONS = {
DROP_STATUS: `${prefix}DROP_STATUS`,
SET_STATUS: `${prefix}SET_STATUS`,
ADD_FILE: `${prefix}ADD_FILE`
ADD_FILE: `${prefix}ADD_FILE`,
};
export const EMPTY_FILE: IFile = {
@ -25,7 +25,7 @@ export const EMPTY_FILE: IFile = {
url: 'https://cdn.arstechnica.net/wp-content/uploads/2017/09/mario-collage-800x450.jpg',
size: 2400000,
type: 'image',
mime: 'image/jpeg'
mime: 'image/jpeg',
};
export const EMPTY_UPLOAD_STATUS: IUploadStatus = {
@ -37,5 +37,26 @@ export const EMPTY_UPLOAD_STATUS: IUploadStatus = {
progress: 0,
thumbnail_url: null,
type: null,
temp_id: null
temp_id: null,
};
// for targeted cancellation
export const UPLOAD_SUBJECTS = {
EDITOR: 'editor',
COMMENT: 'comment',
AVATAR: 'avatar',
};
export const UPLOAD_TARGETS = {
NODES: 'nodes',
COMMENTS: 'comments',
PROFILES: 'profiles',
OTHER: 'other',
};
export const UPLOAD_TYPES: Record<string, IUploadType> = {
IMAGE: 'image',
AUDIO: 'audio',
VIDEO: 'video',
OTHER: 'other',
};