1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/components/cluster-manager/cluster-view.route.ts
Roman d04c8d3045 part 2
Signed-off-by: Roman <ixrock@gmail.com>
2020-08-06 18:15:04 +03:00

23 lines
586 B
TypeScript

import { matchPath, RouteProps } from "react-router";
import { buildURL, navigation } from "../../navigation";
export interface IClusterViewRouteParams {
clusterId: string;
}
export const clusterViewRoute: RouteProps = {
path: "/cluster/:clusterId"
}
export const clusterViewURL = buildURL<IClusterViewRouteParams>(clusterViewRoute.path)
export function getMatchedClusterId(): string {
const matched = matchPath<IClusterViewRouteParams>(navigation.location.pathname, {
...clusterViewRoute,
exact: true,
})
if (matched) {
return matched.params.clusterId;
}
}