keycloak-scim/js/apps/admin-ui/src/client-scopes/routes/ClientScopes.tsx
Erik Jan de Wit 13207aabac
Encode parameters for React Router links in URL-safe manner (#23667)
Closes #22600

Co-authored-by: Jon Koops <jonkoops@gmail.com>
2023-10-17 07:36:26 +00:00

21 lines
689 B
TypeScript

import { lazy } from "react";
import type { Path } from "react-router-dom";
import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes";
export type ClientScopesParams = { realm: string };
const ClientScopesSection = lazy(() => import("../ClientScopesSection"));
export const ClientScopesRoute: AppRouteObject = {
path: "/:realm/client-scopes",
element: <ClientScopesSection />,
breadcrumb: (t) => t("clientScopeList"),
handle: {
access: "view-clients",
},
};
export const toClientScopes = (params: ClientScopesParams): Partial<Path> => ({
pathname: generateEncodedPath(ClientScopesRoute.path, params),
});