X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/e63198a93d7b537ffbb68b8210c99f76041fd112..131e30396e465c422f442becd2aa33cb15512238:/src/store/collection-panel/collection-panel-reducer.ts diff --git a/src/store/collection-panel/collection-panel-reducer.ts b/src/store/collection-panel/collection-panel-reducer.ts index 44b77898..55829cb5 100644 --- a/src/store/collection-panel/collection-panel-reducer.ts +++ b/src/store/collection-panel/collection-panel-reducer.ts @@ -3,24 +3,19 @@ // SPDX-License-Identifier: AGPL-3.0 import { collectionPanelActions, CollectionPanelAction } from "./collection-panel-action"; -import { CollectionResource } from "../../models/collection"; -import { TagResource } from "../../models/tag"; +import { CollectionResource } from "~/models/collection"; export interface CollectionPanelState { item: CollectionResource | null; - tags: TagResource[]; } const initialState = { - item: null, - tags: [] + item: null }; export const collectionPanelReducer = (state: CollectionPanelState = initialState, action: CollectionPanelAction) => collectionPanelActions.match(action, { default: () => state, + SET_COLLECTION: (item) => ({ ...state, item }), LOAD_COLLECTION_SUCCESS: ({ item }) => ({ ...state, item }), - LOAD_COLLECTION_TAGS_SUCCESS: ({ tags }) => ({...state, tags }), - CREATE_COLLECTION_TAG_SUCCESS: ({ tag }) => ({...state, tags: [...state.tags, tag] }), - DELETE_COLLECTION_TAG_SUCCESS: ({ uuid }) => ({...state, tags: state.tags.filter(tag => tag.uuid !== uuid) }) });