X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c0afd448c39a41d229612afe47643aed7a2cf5dd..2ddeeb1b278734e895128feb2caa2bf720192b3d:/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 0dd233eaf0..44b778980b 100644 --- a/src/store/collection-panel/collection-panel-reducer.ts +++ b/src/store/collection-panel/collection-panel-reducer.ts @@ -4,18 +4,23 @@ import { collectionPanelActions, CollectionPanelAction } from "./collection-panel-action"; import { CollectionResource } from "../../models/collection"; +import { TagResource } from "../../models/tag"; export interface CollectionPanelState { item: CollectionResource | null; + tags: TagResource[]; } const initialState = { - item: null + item: null, + tags: [] }; export const collectionPanelReducer = (state: CollectionPanelState = initialState, action: CollectionPanelAction) => collectionPanelActions.match(action, { default: () => state, - LOAD_COLLECTION: () => state, 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) }) });