keycloak-scim/src/clients/routes/NewPermission.ts

28 lines
821 B
TypeScript
Raw Normal View History

import { lazy } from "react";
import { generatePath } from "react-router-dom";
import type { Path } from "react-router-dom-v5-compat";
import type { RouteDef } from "../../route-config";
export type PermissionType = "resource" | "scope";
export type NewPermissionParams = {
realm: string;
id: string;
permissionType: PermissionType;
selectedId?: string;
};
export const NewPermissionRoute: RouteDef = {
path: "/:realm/clients/:id/authorization/permission/new/:permissionType/:selectedId?",
component: lazy(() => import("../authorization/PermissionDetails")),
breadcrumb: (t) => t("clients:createPermission"),
2022-05-30 09:23:24 +00:00
access: "view-clients",
legacy: true,
};
export const toNewPermission = (
params: NewPermissionParams
): Partial<Path> => ({
pathname: generatePath(NewPermissionRoute.path, params),
});