Merge branch '14503_keep_services_panel'
[arvados-workbench2.git] / src / store / keep-services / keep-services-reducer.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { keepServicesActions, KeepServicesActions } from '~/store/keep-services/keep-services-actions';
6 import { KeepServiceResource } from '~/models/keep-services';
7
8 export type KeepSericesState = KeepServiceResource[];
9
10 const initialState: KeepSericesState = [];
11
12 export const keepServicesReducer = (state: KeepSericesState = initialState, action: KeepServicesActions): KeepSericesState =>
13     keepServicesActions.match(action, {
14         SET_KEEP_SERVICES: items => items,
15         REMOVE_KEEP_SERVICE: (uuid: string) => state.filter((keepService) => keepService.uuid !== uuid),
16         default: () => state
17     });