19231: Add smaller page sizes (10 and 20 items) to load faster
[arvados-workbench2.git] / src / store / resources / resources-reducer.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { ResourcesState, setResource, deleteResource } from './resources';
6 import { ResourcesAction, resourcesActions } from './resources-actions';
7
8 export const resourcesReducer = (state: ResourcesState = {}, action: ResourcesAction) =>
9     resourcesActions.match(action, {
10         SET_RESOURCES: resources => resources.reduce(
11             (state, resource) => setResource(resource.uuid, resource)(state),
12             state),
13         DELETE_RESOURCES: ids => ids.reduce(
14             (state, id) => deleteResource(id)(state),
15             state),
16         default: () => state,
17     });