1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { PublicFavoritesAction, publicFavoritesActions } from "./public-favorites-actions";
7 export type PublicFavoritesState = Record<string, boolean>;
9 export const publicFavoritesReducer = (state: PublicFavoritesState = {}, action: PublicFavoritesAction) =>
10 publicFavoritesActions.match(action, {
11 UPDATE_PUBLIC_FAVORITES: publicFavorites => ({ ...state, ...publicFavorites }),
15 export const checkPublicFavorite = (uuid: string, state: PublicFavoritesState) => state[uuid] === true;