05735d6590056275a6893a85310db638930952ac
[arvados-workbench2.git] / src / store / collections / uploader / collection-uploader-reducer.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { CollectionUploaderAction, collectionUploaderActions } from "./collection-uploader-actions";
6 import { CollectionUploadFile } from "../../../models/collection-file";
7
8 export interface CollectionUploaderState {
9     files: File[];
10 }
11
12 const initialState: CollectionUploaderState = {
13     files: []
14 };
15
16 export const collectionUploaderReducer = (state: CollectionUploaderState = initialState, action: CollectionUploaderAction) => {
17     return collectionUploaderActions.match(action, {
18         SET_UPLOAD_FILES: (files) => ({
19             ...state,
20             files
21         }),
22         default: () => state
23     });
24 };