import { snackbarActions, SnackbarKind } from "../snackbar/snackbar-actions";
import { ServiceRepository } from "services/services";
import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions";
+import { loadFavorites} from "store/side-panel-tree/side-panel-tree-actions";
export const favoritesActions = unionize({
TOGGLE_FAVORITE: ofType<{ resourceUuid: string }>(),
kind: SnackbarKind.SUCCESS
}));
dispatch(progressIndicatorActions.STOP_WORKING("toggleFavorite"));
+ dispatch<any>(loadFavorites())
})
.catch((e: any) => {
dispatch(progressIndicatorActions.STOP_WORKING("toggleFavorite"));
if (projectUuid === SidePanelTreeCategory.PUBLIC_FAVORITES) {
await dispatch<any>(loadPublicFavorites);
} else if (projectUuid === SidePanelTreeCategory.FAVORITES) {
- await dispatch<any>(loadFavorites);
+ await dispatch<any>(loadFavorites());
} else if (node || projectUuid !== '') {
await dispatch<any>(loadProject(projectUuid));
}
dispatch(resourcesActions.SET_RESOURCES(items));
};
-const loadFavorites = async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+export const loadFavorites =()=> async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
dispatch(treePickerActions.LOAD_TREE_PICKER_NODE({ id: SidePanelTreeCategory.FAVORITES, pickerId: SIDE_PANEL_TREE }));
const params = {
};
const { items } = await services.linkService.list(params);
- console.log(items)
dispatch(treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({
id: SidePanelTreeCategory.PUBLIC_FAVORITES,
export const activateSidePanelTreeItem = (id: string) =>
async (dispatch: Dispatch, getState: () => RootState) => {
const node = getSidePanelTreeNode(id)(getState().treePicker);
- console.log(id)
if (node && !node.active) {
dispatch(treePickerActions.ACTIVATE_TREE_PICKER_NODE({ id, pickerId: SIDE_PANEL_TREE }));
}