Merge branch '14452-my-account'
[arvados.git] / src / store / repositories / repositories-reducer.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { repositoriesActions, RepositoriesActions } from '~/store/repositories/repositories-actions';
6 import { RepositoryResource } from '~/models/repositories';
7
8 interface Repositories {
9     items: RepositoryResource[];
10 }
11
12 const initialState: Repositories = {
13     items: []
14 };
15
16 export const repositoriesReducer = (state = initialState, action: RepositoriesActions): Repositories =>
17     repositoriesActions.match(action, {
18         SET_REPOSITORIES: items => ({ ...state, items }),
19         default: () => state
20     });