1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { unionize, ofType, UnionOf } from "unionize";
6 import { Dispatch } from "../../../node_modules/redux";
7 import { favoriteService } from "../../services/services";
9 export const favoritesActions = unionize({
10 CHECK_PRESENCE_IN_FAVORITES: ofType<string[]>(),
11 UPDATE_FAVORITES: ofType<Record<string, boolean>>()
12 }, { tag: 'type', value: 'payload' });
14 export type FavoritesAction = UnionOf<typeof favoritesActions>;
16 export const checkPresenceInFavorites = (userUuid: string, resourceUuids: string[]) =>
17 (dispatch: Dispatch) => {
18 dispatch(favoritesActions.CHECK_PRESENCE_IN_FAVORITES(resourceUuids));
20 .checkPresenceInFavorites(userUuid, resourceUuids)
22 dispatch(favoritesActions.UPDATE_FAVORITES(results));