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

41 lines
1.1 KiB
TypeScript
Raw Normal View History

import { lazy } from "react";
2023-01-18 12:09:49 +00:00
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { AppRouteObject } from "../../routes";
export type DedicatedScopeTab = "mappers" | "scope";
export type DedicatedScopeDetailsParams = {
realm: string;
clientId: string;
tab?: DedicatedScopeTab;
};
const DedicatedScopes = lazy(() => import("../scopes/DedicatedScopes"));
export const DedicatedScopeDetailsRoute: AppRouteObject = {
path: "/:realm/clients/:clientId/clientScopes/dedicated",
element: <DedicatedScopes />,
breadcrumb: (t) => t("clients:dedicatedScopes"),
handle: {
access: "view-clients",
},
};
export const DedicatedScopeDetailsWithTabRoute: AppRouteObject = {
...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),
};
};