1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00
vault-frontend/src/redux/uploads/actions.ts
2022-01-02 20:59:52 +07:00

30 lines
768 B
TypeScript

import { UPLOAD_ACTIONS } from '~/redux/uploads/constants';
import { IFile, IFileWithUUID, UUID } from '../types';
import { IUploadStatus } from './reducer';
export const uploadUploadFiles = (files: IFileWithUUID[]) => ({
files,
type: UPLOAD_ACTIONS.UPLOAD_FILES,
});
export const uploadAddStatus = (temp_id: UUID, status?: Partial<IUploadStatus>) => ({
temp_id,
status,
type: UPLOAD_ACTIONS.ADD_STATUS,
});
export const uploadAddFile = (file: IFile) => ({
file,
type: UPLOAD_ACTIONS.ADD_FILE,
});
export const uploadSetStatus = (temp_id: UUID, status?: Partial<IUploadStatus>) => ({
temp_id,
status,
type: UPLOAD_ACTIONS.SET_STATUS,
});
export const uploadDropStatus = (temp_id: UUID) => ({
temp_id,
type: UPLOAD_ACTIONS.DROP_STATUS,
});