X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/e4c3defe5d79926d86f49ba83cfe3125261481cb..605e792e4854c7aad2f08e08fa7a8d9eba9d64a1:/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 769766e192..72c999d0d1 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 }),