Merge branch '17982-recent-saved-searches-display-bug' into main. Closes #17982
[arvados.git] / src / plugins / root-redirect / index.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { PluginConfig } from 'common/plugintypes';
6 import { Dispatch } from 'redux';
7 import { RootState } from 'store/store';
8 import { SidePanelTreeCategory } from 'store/side-panel-tree/side-panel-tree-actions';
9 import { push } from "react-router-redux";
10
11 export const register = (pluginConfig: PluginConfig, redirect: string) => {
12
13     pluginConfig.navigateToHandlers.push((dispatch: Dispatch, getState: () => RootState, uuid: string) => {
14         if (uuid === SidePanelTreeCategory.PROJECTS) {
15             dispatch(push(redirect));
16             return true;
17         }
18         return false;
19     });
20 };