1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { unionize, ofType, UnionOf } from "common/unionize";
6 import { Dispatch } from "redux";
7 import { RootState } from 'store/store';
9 export interface UploadFile {
20 export const fileUploaderActions = unionize({
21 CLEAR_UPLOAD: ofType(),
22 SET_UPLOAD_FILES: ofType<File[]>(),
23 UPDATE_UPLOAD_FILES: ofType<File[]>(),
24 SET_UPLOAD_PROGRESS: ofType<{ fileId: number, loaded: number, total: number, currentTime: number }>(),
25 START_UPLOAD: ofType(),
26 DELETE_UPLOAD_FILE: ofType<UploadFile>(),
27 CANCEL_FILES_UPLOAD: ofType(),
30 export type FileUploaderAction = UnionOf<typeof fileUploaderActions>;
32 export const getFileUploaderState = () => (dispatch: Dispatch, getState: () => RootState) => {
33 return getState().fileUploader;