Merge branch '21128-toolbar-context-menu'
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / favorite-action-set.ts
index 7942937fb3f42c736e1abc0842ec71c224bd2482..bdc4b07a2452658569830103a99b1a58134ca982 100644 (file)
@@ -2,16 +2,22 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { ContextMenuActionSet } from "../context-menu-action-set";
-import { ToggleFavoriteAction } from "../actions/favorite-action";
-import { toggleFavorite } from "~/store/favorites/favorites-actions";
-import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
+import { ContextMenuActionSet } from '../context-menu-action-set';
+import { ToggleFavoriteAction } from '../actions/favorite-action';
+import { toggleFavorite } from 'store/favorites/favorites-actions';
+import { favoritePanelActions } from 'store/favorite-panel/favorite-panel-action';
 
-export const favoriteActionSet: ContextMenuActionSet = [[{
-    component: ToggleFavoriteAction,
-    execute: (dispatch, resource) => {
-        dispatch<any>(toggleFavorite(resource)).then(() => {
-            dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
-        });
-    }
-}]];
+export const favoriteActionSet: ContextMenuActionSet = [
+    [
+        {
+            component: ToggleFavoriteAction,
+            execute: (dispatch, resources) => {
+                resources.forEach((resource) =>
+                    dispatch<any>(toggleFavorite(resource)).then(() => {
+                        dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
+                    })
+                );
+            },
+        },
+    ],
+];