1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { FavoritesAction, favoritesActions } from "./favorites-actions";
7 export type FavoritesState = Record<string, boolean>;
9 export const favoritesReducer = (state: FavoritesState = {}, action: FavoritesAction) =>
10 favoritesActions.match(action, {
11 UPDATE_FAVORITES: favorites => ({...state, ...favorites}),
15 export const checkFavorite = (uuid: string, state: FavoritesState) => state[uuid] === true;