X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/83d2d86a40a316eb332b9962f9fac2eae3259cc2..c11055f2d6ce8385088bc221eab1175e31777ec0:/src/store/collections/creator/collection-creator-reducer.ts diff --git a/src/store/collections/creator/collection-creator-reducer.ts b/src/store/collections/creator/collection-creator-reducer.ts index 769766e1..72c999d0 100644 --- a/src/store/collections/creator/collection-creator-reducer.ts +++ b/src/store/collections/creator/collection-creator-reducer.ts @@ -4,31 +4,22 @@ import { collectionCreateActions, CollectionCreateAction } from './collection-creator-action'; -export type CollectionCreatorState = { - creator: CollectionCreator -}; - -interface CollectionCreator { +export interface CollectionCreatorState { opened: boolean; ownerUuid: string; } -const updateCreator = (state: CollectionCreatorState, creator?: Partial) => ({ +const updateCreator = (state: CollectionCreatorState, creator?: Partial) => ({ ...state, - creator: { - ...state.creator, - ...creator - } + ...creator }); const initialState: CollectionCreatorState = { - creator: { - opened: false, - ownerUuid: "" - } + opened: false, + ownerUuid: '' }; -export const collectionCreationReducer = (state: CollectionCreatorState = initialState, action: CollectionCreateAction) => { +export const collectionCreatorReducer = (state: CollectionCreatorState = initialState, action: CollectionCreateAction) => { return collectionCreateActions.match(action, { OPEN_COLLECTION_CREATOR: ({ ownerUuid }) => updateCreator(state, { ownerUuid, opened: true }), CLOSE_COLLECTION_CREATOR: () => updateCreator(state, { opened: false }),