keycloak-scim/apps/admin-ui/src/clients/routes/DedicatedScopeDetails.ts

37 lines
1 KiB
TypeScript
Raw Normal View History

import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { RouteDef } from "../../route-config";
export type DedicatedScopeTab = "mappers" | "scope";
export type DedicatedScopeDetailsParams = {
realm: string;
clientId: string;
tab?: DedicatedScopeTab;
};
export const DedicatedScopeDetailsRoute: RouteDef = {
path: "/:realm/clients/:clientId/clientScopes/dedicated",
component: lazy(() => import("../scopes/DedicatedScopes")),
breadcrumb: (t) => t("clients:dedicatedScopes"),
2022-05-30 09:23:24 +00:00
access: "view-clients",
};
export const DedicatedScopeDetailsWithTabRoute: RouteDef = {
...DedicatedScopeDetailsRoute,
path: "/:realm/clients/:clientId/clientScopes/dedicated/:tab",
};
export const toDedicatedScope = (
params: DedicatedScopeDetailsParams
): Partial<Path> => {
const path = params.tab
? DedicatedScopeDetailsWithTabRoute.path
: DedicatedScopeDetailsRoute.path;
return {
pathname: generatePath(path, params),
};
};