1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { collectionUpdaterActions, CollectionUpdaterAction } from './collection-updater-action';
7 export interface CollectionUpdaterState {
12 const updateCollection = (state: CollectionUpdaterState, updater?: Partial<CollectionUpdaterState>) => ({
17 const initialState: CollectionUpdaterState = {
22 export const collectionUpdaterReducer = (state: CollectionUpdaterState = initialState, action: CollectionUpdaterAction) => {
23 return collectionUpdaterActions.match(action, {
24 OPEN_COLLECTION_UPDATER: ({ uuid }) => updateCollection(state, { uuid, opened: true }),
25 CLOSE_COLLECTION_UPDATER: () => updateCollection(state, { opened: false, uuid: "" }),
26 UPDATE_COLLECTION_SUCCESS: () => updateCollection(state, { opened: false, uuid: "" }),