X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/e8e0182d65a74b1a222127eb8b36f31a906b14c8..a1e2b8ba77e4a7273940a3fc542bc42e282618a7:/src/store/keep-services/keep-services-reducer.ts diff --git a/src/store/keep-services/keep-services-reducer.ts b/src/store/keep-services/keep-services-reducer.ts new file mode 100644 index 00000000..043c010a --- /dev/null +++ b/src/store/keep-services/keep-services-reducer.ts @@ -0,0 +1,17 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + +import { keepServicesActions, KeepServicesActions } from '~/store/keep-services/keep-services-actions'; +import { KeepServiceResource } from '~/models/keep-services'; + +export type KeepSericesState = KeepServiceResource[]; + +const initialState: KeepSericesState = []; + +export const keepServicesReducer = (state: KeepSericesState = initialState, action: KeepServicesActions): KeepSericesState => + keepServicesActions.match(action, { + SET_KEEP_SERVICES: items => items, + REMOVE_KEEP_SERVICE: (uuid: string) => state.filter((keepService) => keepService.uuid !== uuid), + default: () => state + }); \ No newline at end of file