1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { ResourcesState, setResource, deleteResource } from './resources';
6 import { ResourcesAction, resourcesActions } from './resources-actions';
8 export const resourcesReducer = (state: ResourcesState = {}, action: ResourcesAction) =>
9 resourcesActions.match(action, {
10 SET_RESOURCES: resources => resources.reduce((state, resource) => setResource(resource.uuid, resource)(state), state),
11 DELETE_RESOURCES: ids => ids.reduce((state, id) => deleteResource(id)(state), state),